nacos官方文檔 :https://nacos.io/zh-cn/docs/quick-start.html
源碼下載地址:https://github.com/alibaba/nacos/tree/1.4.2
安裝包下載地址 https://github.com/alibaba/nacos/tags
1 nacos文件下載地址:https://github.com/alibaba/nacos/releases(選擇穩(wěn)定版本下載)
2 數(shù)據(jù)庫配置
2.1 將application.properties 文件重命名為 bootstrap.properties
2.2 使用建表的sql文件創(chuàng)建名為nacos的數(shù)據(jù)庫却桶,并建好表
2.3 編輯該文件微姊,修改后文件內(nèi)容如下
# spring
server.contextPath=/nacos
server.servlet.contextPath=/nacos
server.port=8848
spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://localhost:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user=root
db.password=root
# nacos.cmdb.dumpTaskInterval=3600
# nacos.cmdb.eventTaskInterval=10
# nacos.cmdb.labelTaskInterval=300
# nacos.cmdb.loadDataAtStart=false
# metrics for prometheus
#management.endpoints.web.exposure.include=*
# metrics for elastic search
management.metrics.export.elastic.enabled=false
#management.metrics.export.elastic.host=http://localhost:9200
# metrics for influx
management.metrics.export.influx.enabled=false
#management.metrics.export.influx.db=springboot
#management.metrics.export.influx.uri=http://localhost:8086
#management.metrics.export.influx.auto-create-db=true
#management.metrics.export.influx.consistency=one
#management.metrics.export.influx.compressed=true
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i
# default current work dir
server.tomcat.basedir=
## spring security config
### turn off security
#spring.security.enabled=false
#management.security=false
#security.basic.enabled=false
#nacos.security.ignore.urls=/**
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.taskDispatchPeriod=200
# nacos.naming.distro.batchSyncKeyCount=1000
# nacos.naming.distro.syncRetryDelay=5000
# nacos.naming.data.warmup=true
# nacos.naming.expireInstance=true
nacos.istio.mcp.server.enabled=false
編輯啟動文件,startup.cmd
set MODE="standalone"
3 windows環(huán)境 啟動停止nacos
解壓壓縮包,執(zhí)行bin目錄下的startup.cmd 命令 啟動nacos
執(zhí)行bin目錄下的shutdown.cmd 命令 停止nacos
C:\Users\wqf\Desktop\nacos-server-1.4.2\nacos\bin
訪問nocas的服務端 http://服務器ip:8848/nacos/index.html扫沼,默認的用戶名密碼是 nocas/nocas
4 linux環(huán)境啟停
4.1 把nacos包解壓 tar -zxvf nacos-server-1.4.2.tar.gz
4.2 cd 到我們的解壓目錄nacos cd nacos
4.3 進入到bin目錄下 執(zhí)行命令(啟動單機) sh startup.sh -m standalone /關(guān)閉命令 sh shutdown.sh
4.4 檢查nacos啟動的端口 lsof -i:8848
4.5 訪問nocas的服務端 http://服務器ip:8848/nacos/index.html叁温,默認的用戶名密碼是 nocas/nocas
補充:windows 啟動如果出現(xiàn)問題 編輯start.cmd文件 修改圖示行