sudo passwd root
******
vi /etc/ssh/sshd_config
...
PasswordAuthentication yes
PermitRootLogin yes
...
报存并退出vi,重启sshd
sudo service sshd restart
在这里插入代码片
sudo yum -y install pcre-devel zlib-devel openssl openssl-devel
sudo yum -y install epel-release
sudo yum -y install nginx
sudo yum -y install nginx-all-modules.noarch
systemctl enable nginx && systemctl start nginx
待续
待续
待续
sudo yum -y install -y yum-utils
sudo yum-config-manager -y --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo yum -y install docker
systemctl enable docker && systemctl start docker
vi /etc/docker/daemon.json
...
#镜像服务器
"registry-mirrors": ["https://bfkszez0.mirror.aliyuncs.com"],
#域名解析服务器
"dns": ["8.8.8.8"],
#日志配置
"log-driver":"json-file",
"log-opts":{"max-size":"1500m","max-file":"100"}
...
作用是容器内可以在不知道宿主机ip的情况下使用192.168.0.1来访问宿主机。
docker network create -d bridge --subnet 192.168.0.0/24 --gateway 192.168.0.1 mygateway
docker run --restart=always -d -p 3306:3306 --privileged=true -v /mydata/mysql/log:/var/log/mysql -v /mydata/mysql/data:/var/lib/mysql -v /mydata/mysql/conf:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD="123456" --name mysql mysql:5.7.15
请参考文章操作:https://blog.csdn.net/u012643122/article/details/125899829
docker run --restart=always --log-opt max-size=100m --log-opt max-file=2 -p 6379:6379 --name redis -v /mydata/redis/redis.conf:/etc/redis/redis.conf -v /mydata/redis/data:/data -d redis redis-server /etc/redis/redis.conf --appendonly yes --requirepass 123456
docker run --restart=always --log-opt max-size=100m --log-opt max-file=2 -p 6379:6379 --name redis -v /mydata/redis/redis.conf:/etc/redis/redis.conf -v /mydata/redis/data:/data -d redis redis-server /etc/redis/redis.conf
安装rabbitmq:
docker run --restart=always -d --name rabbitmq -e RABBITMQ_DEFAULT_USER=myname -e RABBITMQ_DEFAULT_PASS=123456 -p 1883:1883 -p 15672:15672 -p 15674:15674 -p 5672:5672 rabbitmq:management
开启mqtt:
docker exec rabbitmq /bin/sh -c "rabbitmq-plugins enable rabbitmq_mqtt;rabbitmq-plugins enable rabbitmq_web_mqtt;"
rabbitmq连接地址:http://宿主机ip:5672
mqtt连接地址:http://宿主机ip:1883
rabbitmq管理界面:http://宿主机ip:15672
安装rabbitmq:
docker run --restart=always -d --name rabbitmq -e RABBITMQ_DEFAULT_USER=myname -e RABBITMQ_DEFAULT_PASS=123456 -p 15672:15672 -p 15674:15674 -p 5672:5672 rabbitmq:management
安装emqx:
docker run -d --name emqx -p 1883:1883 -p 18083:18083 -p 8083:8083 --restart=always emqx/emqx:latest
支持微信小程序websocket:
docker exec -it -uroot emqx bash
echo "listeners.ws.default.websocket.fail_if_no_subprotocol = false" >> ./etc/emqx.conf
emqx管理界面:http://宿主机ip:18083
emqx默认账号密码:admin/public
安装nameserver
docker run -d --restart=always --name rocket-namesrv -p 9876:9876 -v /mydata/rocketmq/namesrv/logs:/root/logs -v /mydata/rocketmq/namesrv/store:/root/store -e "MAX_POSSIBLE_HEAP=100000000" rocketmqinc/rocketmq sh mqnamesrv
新建配置:
vi /mydata/rocketmq/broker/conf/broker.conf
# 所属集群名称,如果节点较多可以配置多个
brokerClusterName = DefaultCluster
#broker名称,master和slave使用相同的名称,表明他们的主从关系
brokerName = broker-a
#0表示Master,大于0表示不同的slave
brokerId = 0
#表示几点做消息删除动作,默认是凌晨4点
deleteWhen = 04
#在磁盘上保留消息的时长,单位是小时
fileReservedTime = 48
#有三个值:SYNC_MASTER,ASYNC_MASTER,SLAVE;同步和异步表示Master和Slave之间同步数据的机制;
brokerRole = ASYNC_MASTER
#刷盘策略,取值为:ASYNC_FLUSH,SYNC_FLUSH表示同步刷盘和异步刷盘;SYNC_FLUSH消息写入磁盘后才返回成功状态,ASYNC_FLUSH不需要;
flushDiskType = ASYNC_FLUSH
# 设置broker节点所在服务器的ip地址
brokerIP1 = 192.168.0.1
# 磁盘使用达到95%之后,生产者再写入消息会报错 CODE: 14 DESC: service not available now, maybe disk full
diskMaxUsedSpaceRatio=95
安装broker:
docker run -d --restart=always --name rmqbroker --link rocket-namesrv:namesrv -p 10911:10911 -p 10909:10909 -v /mydata/rocketmq/broker/logs:/root/logs -v /mydata/rocketmq/broker/store:/root/store -v /mydata/rocketmq/broker/conf/broker.conf:/opt/rocketmq-4.4.0/conf/broker.conf -e "NAMESRV_ADDR=namesrv:9876" -e "MAX_POSSIBLE_HEAP=200000000" rocketmqinc/rocketmq sh mqbroker -c /opt/rocketmq-4.4.0/conf/broker.conf
下载nacos的压缩包(可能需要参考里面的默认配置文件和sql文件):
https://github.com/alibaba/nacos/releases/download/2.2.1/nacos-server-2.2.1.zip
新增配置:
vi /mydata/nacos/conf/application.properties
...
### 修改数据库配置start(如果不需要mysql,将下面配置全部注释即可):
spring.datasource.platform=mysql
spring.sql.init.platform=mysql
db.num=1
db.url.0=jdbc:mysql://192.168.0.1:3306/nacos-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=root
db.password.0=123456
### 修改数据库配置end(如果不需要mysql,将上面配置全部注释即可):
...
### 一定要改这个:
nacos.core.auth.plugin.nacos.token.secret.key=M6vLzgEfg0Tt7nsHgGh84Pb64dXdeKp2C
...
创建数据库nacos-config(如果不需要mysql,则无需执行):
docker exec mysql /bin/sh -c "mysql -uroot -p123456 -e \"create database nacos-config default character set utf8 collate utf8_bin\""
运行nacos自带的sql(如果不需要mysql,则无需执行):
docker cp /mydata/nacos/conf/mysql-schema.sql mysql:/home/nacos_config.sql
docker exec mysql /bin/sh -c "mysql -uroot -p123456 -e \"source /home/nacos_config.sql\""
安装nacos
docker run -d --name nacos -p 8848:8848 -p 9848:9848 -p 9849:9849 -e MODE=standalone -v /mydata/nacos/logs/:/home/nacos/logs -v /mydata/nacos/conf/:/home/nacos/conf/ --restart=always nacos/nacos-server:v2.2.1
客户端访问地址:
nacos连接地址:server-addr: 宿主机ip:8848
nacos管理界面:http://宿主机ip:8848/nacos
nacos默认账号密码:nacos/nacos
集群版只比单机版多个cluster.conf配置文件,其他都一样
新增配置application.properties(参考单机版,省略):
vi /mydata/nacos/conf/application.properties
新增配置cluster.conf:
vi /mydata/nacos/conf/cluster.conf
192.168.0.1:8848
192.168.0.1:8858
安装nacos1
docker run -d --name nacos1 -p 8848:8848 -p 9848:9848 -p 9849:9849 -v /mydata/nacos1/logs/:/home/nacos/logs -v /mydata/nacos1/conf/:/home/nacos/conf/ --restart=always nacos/nacos-server:v2.2.1
安装nacos2
docker run -d --name nacos2 -p 8858:8848 -p 9858:9848 -p 9859:9849 -v /mydata/nacos2/logs/:/home/nacos/logs -v /mydata/nacos2/conf/:/home/nacos/conf/ --restart=always nacos/nacos-server:v2.2.1
客户端访问地址:
nacos连接地址:server-addr: 宿主机ip:8848,宿主机ip:8858
nacos1管理界面:http://宿主机ip:8848/nacos
nacos2管理界面:http://宿主机ip:8858/nacos
nacos默认账号密码:nacos/nacos