安装docker
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker
# 开机自启动
sudo systemctl enable docker
docker安装MySQL
参考:https://juejin.cn/post/6844904122932871182
docker pull mysql:8.0
docker images |grep mysql
docker run --name mysql01 \
-p 3306:3306 \
-v /app/mysql/my.cnf:/etc/mysql/my.cnf \
-v /app/mysql/data:/var/lib/mysql \
-v /app/mysql/log:/logs \
-v /app/mysql/mysql-files:/var/lib/mysql-files \
-e MYSQL_ROOT_PASSWORD=root \
--restart=always \
-d mysql:8.0
-p 3306:3306:将容器的 3306 端口映射到主机的 3306 端口。 -v /app/mysql/conf.d:/etc/mysql/conf.d -v /app/mysql/logs:/logs -v /app/mysql/data:/var/lib/mysql:挂载文件 -e MYSQL_ROOT_PASSWORD=123456:初始化 root 用户的密码。
# 进入容器
docker exec -it mysql01 /bin/bash
docker安装Redis
docker run -p 6379:6379 --name redis01 \
-v /app/redis/redis.conf:/etc/redis/redis.conf \
-v /app/redis:/data \
-d redis redis-server /etc/redis/redis.conf
docker安装nacos
新建文件夹 init.d logs 新建文件 custom.properties
server.contextPath=/nacos
server.servlet.contextPath=/nacos
server.port=8848
spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://bj-cynosdbmysql-grp-brlewqje.sql.tencentcdb.com:12306/study-nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true
db.user=root
db.password=root
nacos.cmdb.dumpTaskInterval=3600
nacos.cmdb.eventTaskInterval=10
nacos.cmdb.labelTaskInterval=300
nacos.cmdb.loadDataAtStart=false
management.metrics.export.elastic.enabled=false
management.metrics.export.influx.enabled=false
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i
nacos.security.ignore.urls=/,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/login,/v1/console/health/**,/v1/cs/**,/v1/ns/**,/v1/cmdb/**,/actuator/**,/v1/console/server/**
nacos.naming.distro.taskDispatchThreadCount=1
nacos.naming.distro.taskDispatchPeriod=200
nacos.naming.distro.batchSyncKeyCount=1000
nacos.naming.distro.initDataRatio=0.9
nacos.naming.distro.syncRetryDelay=5000
nacos.naming.data.warmup=true
nacos.naming.expireInstance=true
docker run --name nacos01 -d \
-p 8848:8848 \
--privileged=true \
--restart=always \
-e JVM_XMS=256m \
-e JVM_XMX=256m \
-e MODE=standalone \
-e PREFER_HOST_MODE=hostname \
-v /app/nacos/logs:/home/nacos/logs \
-v /app/nacos/init.d/custom.properties:/home/nacos/init.d/custom.properties \
nacos/nacos-server
docker安装RabbitMQ
docker pull docker.io/rabbitmq:3.8-management
# 运行
docker run -d --name rabbitmq01 \
-p 5672:5672 -p 15672:15672 \
-v /app/rabbitmq:/var/lib/rabbitmq --hostname localhost \
-e RABBITMQ_DEFAULT_VHOST=localhost \
-e RABBITMQ_DEFAULT_USER=root \
-e RABBITMQ_DEFAULT_PASS=root \
rabbitmq:3.8-management
|