1、Docker下载镜像
docker pull nacos/nacos-server
笔者下载时曾经到1.3.2 其中mysqljar曾经更新至8.0.16
2、创立数据库
create database nacos_config
https://github.com/alibaba/na...
复制sql并执行
3、创立Nacos容器
docker run -d \-e PREFER_HOST_MODE=hostname \-e MODE=standalone \-e SPRING_DATASOURCE_PLATFORM=mysql \-e MYSQL_MASTER_SERVICE_HOST=数据库ip \-e MYSQL_MASTER_SERVICE_PORT=数据库端口 \-e MYSQL_MASTER_SERVICE_USER=用户名 \-e MYSQL_MASTER_SERVICE_PASSWORD=明码 \-e MYSQL_MASTER_SERVICE_DB_NAME=对应的数据库名 \-e MYSQL_SLAVE_SERVICE_HOST=从数据库ip \-p 8848:8848 \--name nacos-sa-mysql \--restart=always \nacos/nacos-server
4、批改容器
docker exec -it nacos bash#进入nacos容器:docker exec -it nacos bash #进入conf文件夹cd conf#批改配置参数vim application.properties
# springserver.servlet.contextPath=${SERVER_SERVLET_CONTEXTPATH:/nacos}server.contextPath=/nacosserver.port=${NACOS_APPLICATION_PORT:8848}spring.datasource.platform=${SPRING_DATASOURCE_PLATFORM:mysql}nacos.cmdb.dumpTaskInterval=3600nacos.cmdb.eventTaskInterval=10nacos.cmdb.labelTaskInterval=300nacos.cmdb.loadDataAtStart=falsedb.num=${MYSQL_DATABASE_NUM:1}db.url.0=jdbc:mysql://${MYSQL_SERVICE_HOST:mysql地址}:${MYSQL_SERVICE_PORT:端口}/${MYSQL_SERVICE_DB_NAME:数据库名}?serverTimezone=GMT%2B8&characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true#db.url.1=jdbc:mysql://${MYSQL_SERVICE_HOST}:${MYSQL_SERVICE_PORT:3306}/${MYSQL_SERVICE_DB_NAME}?serverTimezone=GMT%2B8&characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=truedb.user=${MYSQL_SERVICE_USER:oam}db.password=${MYSQL_SERVICE_PASSWORD:Ssl_qjy&^986_}### The auth system to use, currently only 'nacos' is supported:nacos.core.auth.system.type=${NACOS_AUTH_SYSTEM_TYPE:nacos}### The token expiration in seconds:nacos.core.auth.default.token.expire.seconds=${NACOS_AUTH_TOKEN_EXPIRE_SECONDS:18000}### The default token:nacos.core.auth.default.token.secret.key=${NACOS_AUTH_TOKEN:SecretKey012345678901234567890123456789012345678901234567890123456789}### Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay.nacos.core.auth.caching.enabled=${NACOS_AUTH_CACHE_ENABLE:false}server.tomcat.accesslog.enabled=${TOMCAT_ACCESSLOG_ENABLED:false}server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D# default current work dirserver.tomcat.basedir=## spring security config### turn off securitynacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**# metrics for elastic searchmanagement.metrics.export.elastic.enabled=falsemanagement.metrics.export.influx.enabled=falsenacos.naming.distro.taskDispatchThreadCount=10nacos.naming.distro.taskDispatchPeriod=200nacos.naming.distro.batchSyncKeyCount=1000nacos.naming.distro.initDataRatio=0.9nacos.naming.distro.syncRetryDelay=5000nacos.naming.data.warmup=true
相干文章:
DOCKER内部署单机NACOS应用MYSQL8.0存储
SpringCloud Alibaba之Nacos集群、长久化