K8s

docker持久化nacos1.4.3

2022-05-09  本文已影响0人  andrewkk
用户:nacos,密码:nacos
导入数据库
source nacos-mysql.sql


建立持久化目录
mkdir -p /opt/docker/nacos/{conf,logs,data}
注解:
conf:nacos配置存放目录
logs:nacos日志存放目录
data:nacos数据存放目录

docker pull nacos/nacos-server:v1.4.3


docker run -d -p 38848:8848 \
--restart=always \
--privileged=true \
--name nacos \
--ip 172.16.0.213 \
--env MODE=standalone \
--env SPRING_DATASOURCE_PLATFORM=mysql \
--env MYSQL_SERVICE_HOST=rm-xsaasxadasdsadas.mysql.rds.aliyuncs.com \
--env MYSQL_SERVICE_PORT=3306 \
--env MYSQL_SERVICE_DB_NAME=nacos \
--env MYSQL_SERVICE_USER=dev \
--env MYSQL_SERVICE_PASSWORD='xasdsaqqqqqqdass' \
nacos/nacos-server:v1.4.3

把文件拷贝出来
docker cp -a nacos:/home/nacos /data/docker/



docker run -d -p 8848:8848 \
--name nacos \
--restart=always \
--privileged=true \
--env MODE=standalone \
-v /etc/localtime:/etc/localtime:ro \
-v /data/docker/nacos/conf:/home/nacos/conf \
-v /data/docker/nacos/logs:/home/nacos/logs \
-v /data/docker/nacos/data:/home/nacos/data \
nacos/nacos-server:v1.4.3


[root@iZwz992hxzv1yc62kzs40wZ conf]# grep -Ev '^#|^$' application.properties
server.servlet.contextPath=/nacos
server.port=8848
nacos.inetutils.ip-address=172.16.0.213
spring.datasource.platform=mysql
db.num=1
db.url=jdbc:mysql://rm-XXXXXX.mysql.rds.aliyuncs.com:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user=dev
db.password=XXXXX
db.pool.config.connectionTimeout=30000
db.pool.config.validationTimeout=10000
db.pool.config.maximumPoolSize=20
db.pool.config.minimumIdle=2
nacos.naming.empty-service.auto-clean=true
nacos.naming.empty-service.clean.initial-delay-ms=50000
nacos.naming.empty-service.clean.period-time-ms=30000
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 %{Request-Source}i
server.tomcat.basedir=
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
nacos.core.auth.system.type=nacos
nacos.core.auth.enabled=false
nacos.core.auth.default.token.expire.seconds=18000
nacos.core.auth.default.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789
nacos.core.auth.caching.enabled=true
nacos.core.auth.enable.userAgentAuthWhite=true
nacos.core.auth.server.identity.key=
nacos.core.auth.server.identity.value=
nacos.istio.mcp.server.enabled=false


docker restart $(docker ps | grep test | awk '{ print $1}')
上一篇下一篇

猜你喜欢

热点阅读