Nacos 快速开始
这个快速开始手册是帮忙您快速在您的电脑上,下载、安装并使用 Nacos。
0. 版本选择
You can find the features supported by each release on the Nacos download page, in the release notes, and in release announcements. The currently recommended stable version for the 2.x series is 2.5.5.
1. 预备环境准备
Nacos 依赖 Java 环境来运行,请确保是在以下版本环境中安装使用:
2. 下载安装包
你可以通过Nacos官网网站及Github两种方式来获取 Nacos 发行包 。
Open the Nacos download page, find the 2.x table under Stable Versions, and download 2.5.5.zip from the Binary Package Download column.
注意:有时大量用户同时进行下载时,可能会遇到下载限流失败的情况,若出现下载限流失败,请稍等后重试,或采用
从 Github 下载方式。
Open the Nacos GitHub 2.5.5 release page and download nacos-server-2.5.5.zip or nacos-server-2.5.5.tar.gz from Assets.
3. 解压缩Nacos 发行包
unzip nacos-server-2.5.5.zip # Or tar -xvf nacos-server-2.5.5.tar.gz cd nacos/bin4.启动服务器
- 注:Nacos的运行建议至少在2C4G 60G的机器配置下运行。
启动命令(standalone代表着单机模式运行,非集群模式):
sh startup.sh -m standalone
如果您使用的是ubuntu系统,或者运行脚本报错提示[[符号找不到,可尝试如下运行:
启动命令(standalone代表着单机模式运行,非集群模式):
startup.cmd -m standalone
5.验证Nacos服务是否启动成功
进入${nacos.home}/logs/ 目录下, 使用tail -f start.out 查看日志,如果看到如下日志,说明服务启动成功。
Nacos started successfully in stand alone mode. use embedded storage可以通过下列服务,快速检验Nacos的功能。
5.1. 服务注册
curl -X POST 'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080'
5.2. 服务发现
curl -X GET 'http://127.0.0.1:8848/nacos/v1/ns/instance/list?serviceName=nacos.naming.serviceName'
5.3. 发布配置
curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=HelloWorld"
5.4. 获取配置
curl -X GET "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test"
5.5. Nacos控制台页面
打开任意浏览器,输入地址:http://127.0.0.1:8848/nacos,即可进入Nacos控制台页面。
6.关闭服务器
6.1. Linux/Unix/Mac
sh shutdown.sh
6.2. Windows
shutdown.cmd
或者双击shutdown.cmd运行文件。