Nacos是一个更易于构建云原生应用的动态服务发现、配置管理和服务管理平台,Nacos 致力于帮助您发现、配置和管理微服务。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据及流量管理。
1、Nacos发布地址:https://github.com/alibaba/nacos/releases,从里面选择需要的版本,这里选择1.4.0版本,下载地址为:
https://github.com/alibaba/nacos/releases/download/1.4.0/nacos-server-1.4.0.tar.gz。
image.png
2、下载完成后,上传到测试Linux服务器解压。(如果只想本地windows安装,可以下载nacos-server-1.4.0.zip,解压后使用方法基本一致)
[root@localhost soft_home]# cd nacos [root@localhost nacos]# ls nacos-server-1.4.0.tar.gz [root@localhost nacos]# tar -zxvf nacos-server-1.4.0.tar.gz nacos/LICENSE nacos/NOTICE nacos/target/nacos-server.jar nacos/conf/ nacos/conf/schema.sql nacos/conf/nacos-mysql.sql nacos/conf/application.properties.example nacos/conf/nacos-logback.xml nacos/conf/cluster.conf.example nacos/conf/application.properties nacos/bin/startup.sh nacos/bin/startup.cmd nacos/bin/shutdown.sh nacos/bin/shutdown.cmd [root@localhost nacos]# ls nacos nacos-server-1.4.0.tar.gz [root@localhost nacos]# cd nacos [root@localhost nacos]# ls bin conf LICENSE NOTICE target [root@localhost nacos]# cd bin [root@localhost bin]# ls shutdown.cmd shutdown.sh startup.cmd startup.sh [root@localhost bin]# pwd /bigdata/soft_home/nacos/nacos/bin [root@localhost bin]#
3、修改配置文件的数据库连接,修改为自己实际的数据
#*************** Config Module Related Configurations ***************# ### If use MySQL as datasource: spring.datasource.platform=mysql ### Count of DB: db.num=1 ### Connect URL of DB: db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC db.user=nacos db.password=nacos
4、在数据库中刷入/nacos/conf目录下的nacos-mysql.sql数据库脚本,如果需要其他配置或者了解使用方式可以访问官网,官网地址:https://nacos.io/zh-cn/docs/quick-start.html。
5、进入到bin目录下直接执行sh startup.sh -m standalone。
[root@localhost bin]# sh startup.sh -m standalone /usr/java/jdk1.8.0_77/bin/java -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/bigdata/soft_home/nacos/nacos/logs/java_heapdump.hprof -XX:-UseLargePages -Dnacos.member.list= -Djava.ext.dirs=/usr/java/jdk1.8.0_77/jre/lib/ext:/usr/java/jdk1.8.0_77/lib/ext -Xloggc:/bigdata/soft_home/nacos/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/bigdata/soft_home/nacos/nacos/plugins/health,/bigdata/soft_home/nacos/nacos/plugins/cmdb -Dnacos.home=/bigdata/soft_home/nacos/nacos -jar /bigdata/soft_home/nacos/nacos/target/nacos-server.jar --spring.config.location=file:/bigdata/soft_home/nacos/nacos/conf/,classpath:/,classpath:/config/,file:./,file:./config/ --logging.config=/bigdata/soft_home/nacos/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288 nacos is starting with cluster nacos is starting,you can check the /bigdata/soft_home/nacos/nacos/logs/start.out
6、服务启动之后,可以访问http://ip:8848/nacos访问管理后台,默认用户名密码:nacos/nacos
image.png
image.png