当前位置:   article > 正文

redis的搭建 && RabbitMq搭建

redis的搭建 && RabbitMq搭建

官网 

Download | Redis

wget https://github.com/redis/redis/archive/7.2.4.tar.gz

编译安装

  1. yum install gcc g++
  2. tar -zxvf redis-7.2.4.tar.gz -C /usr/local
  3. cd /usr/local/redis
  4. make && make install

 常见报错

zmalloc.h:50:10: fatal error: jemalloc/jemalloc.h: No such file or directory

解决办法: 清理编译的残留 重新编译  make distclean && make 

设置环境变量 

vim ~/.bashrc 

  1. # Source global definitions
  2. if [ -f /etc/bashrc ]; then
  3. . /etc/bashrc
  4. fi
  5. export PATH=/usr/local/bin:$PATH

source ~/.bashrc

基本应用设置

  1. 设置后台启动
  2. daemonize yes
  3. 设置密码
  4. requirepass 123456

启动

redis-server /usr/local/redis/redis.conf

测试

  1. redis-cli
  2. auth 12345
  3. 127.0.0.1:6379> set a b
  4. OK
  5. 127.0.0.1:6379> get a

开机自启动

vim //usr/lib/systemd/system/redis.service 

  1. [Unit]
  2. Description=redis-server
  3. After=network.target
  4. [Service]
  5. Type=forking
  6. ExecStart=/usr/local/bin/redis-server /usr/local/redis/redis.conf
  7. PrivateTmp=true
  8. [Install]
  9. WantedBy=multi-user.target

 启动系统服务

  1. #重载系统服务
  2. systemctl daemon-reload
  3. #设置开机自启
  4. systemctl enable redis.service
  5. #取消开机自启
  6. systemctl disable redis.service
  7. #启动服务
  8. systemctl start redis.service
  9. #停止服务
  10. systemctl stop redis.service
  11. #查看服务状态
  12. systemctl status redis.service

 RabbitMQ 搭建

安装 erlang 

  1. yum -y install epel-release
  2. yum -y install erlang socat

官网 

Installing on RPM-based Linux (RHEL, CentOS Stream, Fedora, Amazon Linux 2023, openSUSE) — RabbitMQ

找到centos7 对应的版本 3.8.30 

wget https://github.com/rabbitmq/rabbitmq-server/releases/tag/v3.8.30

 rpm 安装

rpm -Uvh rabbitmq-server-3.8.30-1.el7.noarch.rpm

启动

  1. systemctl start rabbitmq-server
  2. systemctl enable rabbitmq-server
  3. systemctl status rabbitmq-server

添加防火墙规则

  1. firewall-cmd –zone=public –permanent –add-port=4369/tcp
  2. firewall-cmd –zone=public –permanent –add-port=25672/tcp
  3. firewall-cmd –zone=public –permanent –add-port=5671-5672/tcp
  4. firewall-cmd –zone=public –permanent –add-port=15672/tcp
  5. firewall-cmd –zone=public –permanent –add-port=61613-61614/tcp
  6. firewall-cmd –zone=public –permanent –add-port=1883/tcp
  7. firewall-cmd –zone=public –permanent –add-port=8883/tcp

访问web控制台 

  1. 启动web 控制台
  2. rabbitmq-plugins enable rabbitmq_management
  3. 设置权限
  4. chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/
  5. 设置admin用户权限 强密码
  6. rabbitmqctl add_user admin 123456Strongpasswd
  7. rabbitmqctl set_user_tags admin administrator
  8. rabbitmqctl set_permissions -p / admin “.*” “.*” “.*

   

nginx端口转发

  1. server {
  2. listen 80;
  3. server_name localhost;
  4. #charset koi8-r;
  5. #access_log logs/host.access.log main;
  6. location / {
  7. proxy_pass http://127.0.0.1:15672;
  8. proxy_set_header Host $proxy_host;
  9. proxy_set_header X-Real-IP $remote_addr;
  10. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  11. }

Elasticsearch 7.6 搭建    es

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/125794
推荐阅读
相关标签
  

闽ICP备14008679号