Linux安装RabbitMQ

下载方式

百度网盘链接:https://pan.baidu.com/s/1loZ3vbA_YaYMLtd4U5XYFw
提取码:l3y1

进入Linux相关目录

[root@myserver ~]# cd /usr/local/software
[root@myserver software]# ls
erlang-23.2.3-1.el7.x86_64.rpm  rabbitmq-server-3.8.11-1.el7.noarch.rpm  redis-6.2.6  redis-6.2.6.tar.gz

上传下载的文件,开始安装Erlang:

[root@myserver software]# rpm -ivh erlang-23.2.3-1.el7.x86_64.rpm
警告:erlang-23.2.3-1.el7.x86_64.rpm: 头V4 RSA/SHA1 Signature, 密钥 ID 6026dfca: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:erlang-23.2.3-1.el7              ################################# [100%]

再用yum 安装的方式安装socat 插件:

[root@myserver software]# yum install -y socat

安装RabbitMQ:

[root@myserver software]# rpm -ivh rabbitmq-server-3.8.11-1.el7.noarch.rpm 
警告:rabbitmq-server-3.8.11-1.el7.noarch.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 6026dfca: NOKEY
准备中...                          ################################# [100%]
正在升级/安装...
   1:rabbitmq-server-3.8.11-1.el7     ################################# [100%]

启动RabbitMQ并查看状态:

[root@myserver software]# systemctl start rabbitmq-server
[root@myserver software]# systemctl status rabbitmq-server
● rabbitmq-server.service - RabbitMQ broker
   Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)
   Active: active (running) since 六 2022-03-26 14:31:03 CST; 23s ago
 Main PID: 30162 (beam.smp)
   Status: "Initialized"
   CGroup: /system.slice/rabbitmq-server.service
           ├─30162 /usr/lib64/erlang/erts-11.1.7/bin/beam.smp -W w -MBas ageffcbf -MHas ageffcbf -MBlmbcs 512...
           ├─30177 erl_child_setup 32768
           ├─30205 /usr/lib64/erlang/erts-11.1.7/bin/epmd -daemon
           ├─30236 inet_gethost 4
           └─30237 inet_gethost 4

326 14:31:00 myserver rabbitmq-server[30162]: ##########  Licensed under the MPL 2.0. Website: https:....com
326 14:31:00 myserver rabbitmq-server[30162]: Doc guides: https://rabbitmq.com/documentation.html
326 14:31:00 myserver rabbitmq-server[30162]: Support:    https://rabbitmq.com/contact.html
326 14:31:00 myserver rabbitmq-server[30162]: Tutorials:  https://rabbitmq.com/getstarted.html
326 14:31:00 myserver rabbitmq-server[30162]: Monitoring: https://rabbitmq.com/monitoring.html
326 14:31:00 myserver rabbitmq-server[30162]: Logs: /var/log/rabbitmq/[email protected]
326 14:31:00 myserver rabbitmq-server[30162]: /var/log/rabbitmq/rabbit@myserver_upgrade.log
326 14:31:00 myserver rabbitmq-server[30162]: Config file(s): (none)
326 14:31:03 myserver rabbitmq-server[30162]: Starting broker... completed with 0 plugins.
326 14:31:03 myserver systemd[1]: Started RabbitMQ broker.
Hint: Some lines were ellipsized, use -l to show in full.

安装RabbitMQWeb界面管理:

[root@myserver software]# rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@myserver:
rabbitmq_management
The following plugins have been configured:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch
Applying plugin configuration to rabbit@myserver...
The following plugins have been enabled:
  rabbitmq_management
  rabbitmq_management_agent
  rabbitmq_web_dispatch

started 3 plugins.

在云服务上配置安全组规则后,通过winds输入ip地址访问控制台:ip地址:15672
可以使用初始账户guest 密码guest 登录。

使用命令再创建一个rabbitmq的管理员账户:

[root@myserver software]# rabbitmqctl add_user root jingxin.Ab257
Adding user "root" ...
Done. Don't forget to grant the user permissions to some virtual hosts! See 'rabbitmqctl help set_permissions' to learn more.

用户创建好之后,再给用户管理员的角色:

[root@myserver software]# rabbitmqctl set_user_tags root administrator
Setting tags for user "root" to [administrator] ...

然后使用新创建的用户就可以登录控制台:

rabbitmq其他命令:

[root@myserver rabbitmq]# systemctl start rabbitmq-server  # 启动
[root@myserver rabbitmq]# systemctl enable rabbitmq-server  # 开机自启
[root@myserver rabbitmq]# systemctl stop rabbitmq-server  # 暂停
[root@myserver rabbitmq]# systemctl restart rabbitmq-server  # 重启
[root@myserver rabbitmq]# systemctl status rabbitmq-server.service  # 查看状态

你可能感兴趣的:(环境安装,rabbitmq,linux,分布式)