本文主要记录nacos在centos7下面的主要安装记录,以方便后续使用
环境:centos7+docker+mysql+nacos
准备:
1.docker安装
省略
2.mysql安装
3.nacos安装
docker pull nacos/nacos-server:latest
查询mysql IP : docker inspect mysql | grep IPAddress
磁盘映射:
宿机:
mkdir -p /opt/nacos/conf
mkdir -p /opt/nacos/logs
mkdir -p /opt/nacos/init.d
vi /opt/nacos/init.d/custom.properties,参考如下配置:
server.contextPath=/nacos server.servlet.contextPath=/nacos server.port=8848 spring.datasource.platform=mysql db.num=1 db.url.0=jdbc:mysql://172.17.0.3:3306/db_nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true db.user=root db.password=123456 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
mysql 脚本详见官方源码nacos/distribution/conf/nacos-mysql.sql
docker run
--name nacos-test -d
-e MODE=standalone
-e PREFER_HOST_MODE=hostname
-e SPRING_DATASOURCE_PLATFORM=mysql
-e MYSQL_SERVICE_HOST=172.17.0.3
-e MYSQL_SERVICE_PORT=3306
-e MYSQL_SERVICE_USER='root'
-e MYSQL_SERVICE_PASSWORD='123456'
-e MYSQL_SERVICE_DB_NAME=db_nacos
-e TIME_ZONE='Asia/Shanghai'
-v /opt/nacos/logs:/home/nacos/logs
-v /opt/nacos/init.d/custom.properties:/home/nacos/init.d/custom.properties
--restart=always
--privileged=true
-p 8848:8848
-e JVM_XMS=256m
-e JVM_XMX=256m
nacos/nacos-server:latest
4.访问测试
http://192.168.125.168:8848/nacos/
上面表明安装成功.
5.应用开发
省略