需要git上下载它的源码,进行编译,然后启动它,在linux,windows上都是支持的。
git clone https://github.com/alibaba/nacos.git
cd nacos/
mvn -Prelease-nacos clean install -U
ls -al distribution/target/
// change the
v
e
r
s
i
o
n
t
o
y
o
u
r
a
c
t
u
a
l
p
a
t
h
c
d
d
i
s
t
r
i
b
u
t
i
o
n
/
t
a
r
g
e
t
/
n
a
c
o
s
−
s
e
r
v
e
r
−
version to your actual path cd distribution/target/nacos-server-
versiontoyouractualpathcddistribution/target/nacos−server−version/nacos/bin
启动服务
sh startup.sh -m standalone //linux
startup.cmd //windows
自定义端口
程序启动默认占用的端口是8848,我们可以对端口进行修改,用编辑器打开bin目录下的startup.cmd文件中添加一行代码
set "JAVA_OPT=%JAVA_OPT% --server.port=8080
访问服务
访问地址:http://127.0.0.1:8848/nacos //用户名密码都是nacos
客户端
直接发布配置
curl -X POST “http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=demo.yaml&group=DEFAULT_GROUP&content=HelloWorld”
直接获取配置
curl -X GET “http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=demo.yaml&group=DEFAULT_GROUP”
结果
深圳网站建设www.sz886.com