1.linux版rabbitmq修改日誌和數據存放路徑
示例:html
rpm包安裝日誌和數據存放都在 /var下linux
(1)先建立數據文件和日誌文件存放位置的目錄並給權限vim
#mkdir -pv /usr/local/rabbitmq/mnesia #mkdir -pv /usr/local/rabbitmq/log #chmod -R 777 /usr/local/rabbitmq #chown -R rabbitmq:rabbitmq /usr/local/rabbitmq/mnesia #chown -R rabbitmq:rabbitmq /usr/local/rabbitmq/log
(2)建立或新增環境參數配置文件
#vim /etc/rabbitmq/rabbitmq-env.conf
增長以下兩行內容
RABBITMQ_MNESIA_BASE=/usr/local/rabbitmq/mnesia
RABBITMQ_LOG_BASE=/usr/local/rabbitmq/log
保存,重啓rabbitmq服務,修改數據文件和日誌文件存放位置,至關於重置rabbitmq;windows
#rabbitmqctl stop #rabbitmq-server -detached
(3)從新啓用插件及添加用戶 spa
#rabbitmq-plugins enable rabbitmq_management #rabbitmq-plugins enable rabbitmq_consistent_hash_exchange #rabbitmqctl add_user rabbitmq rabbitmq #rabbitmqctl set_user_tags rabbitmq administrator #rabbitmqctl set_permissions -p / rabbitmq ".*" ".*" ".*"
2.windows版rabbitmq修改日誌和數據存放路徑
注意: erlang和rabbitmq不要安裝在C盤插件
示例:日誌
(1)修改sbin/rabbitmq-env.bat使得用戶目錄爲rabbitmq安裝目錄下的user目錄code
在如下行
if not defined ERLANG_HOME (
for /f "delims=" %%F in ('where.exe erl.exe') do @set ERL_PATH=%%F
if exist "!ERL_PATH!" (
for /f "delims=" %%F in ("!ERL_PATH!") do set ERL_DIRNAME=%%~dpF
for /f "delims=" %%F in ("!ERL_DIRNAME!\..") do @set ERLANG_HOME=%%~dpsF%%~nF%%~xF
)
set ERL_PATH=
set ERL_DIRNAME=
)server
後面添加以下:
set RABBITMQ_BASE=!RABBITMQ_HOME!/userhtm
(2)在sbin目錄下運行
#rabbitmq-service.bat install
(3)從新啓用插件及添加用戶
#rabbitmq-plugins.bat enable rabbitmq_management #rabbitmq-plugins.bat enable rabbitmq_consistent_hash_exchange #rabbitmqctl.bat add_user rabbitmq rabbitmq #rabbitmqctl.bat set_user_tags rabbitmq administrator #rabbitmqctl.bat set_permissions -p / rabbitmq ".*" ".*" ".*"
(4)命令啓動
禁止系統註冊的rabbitmq服務,只使用命令啓動
#rabbitmq-ctl.bat stop #rabbitmq-service.bat -detached