Nacos 快速开始

匿名 (未验证) 提交于 2019-12-03 00:08:02

原文:https://nacos.io/zh-cn/docs/quick-start.html

https://www.jianshu.com/p/16ff6d6db0cf

 

Nacos安装:

1、从 Github 上下载源码

git clone https://github.com/alibaba/nacos.git cd nacos/ mvn -Prelease-nacos clean install -U   ls -al distribution/target/  // change the $version to your actual path cd distribution/target/nacos-server-$version/nacos/bin

2、启动服务

Linux/Unix/Mac

启动命令(standalone代表着单机模式运行,非集群模式):

sh startup.sh -m standalone

如果您使用的是ubuntu系统,或者运行脚本报错提示[[符号找不到,可尝试如下运行:

bash startup.sh -m standalone

Windows

启动命令:

cmd startup.cmd

或者双击startup.cmd运行文件。

3.服务注册&发现和配置管理

服务注册

curl -X POST 'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080'

服务发现

curl -X GET 'http://127.0.0.1:8848/nacos/v1/ns/instance/list?serviceName=nacos.naming.serviceName'

发布配置

curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=HelloWorld"

获取配置

curl -X GET "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test"

4.关闭服务器

Linux/Unix/Mac

sh shutdown.sh

Windows

cmd shutdown.cmd

或者双击shutdown.cmd运行文件。

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!