Nacos 部署问题
shl:~/nacos/bin$ cat /home/ekmp/nacos/logs/start.out
/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/ekmp/nacos/logs/java_heapdump.hprof -XX:-UseLargePages -Djava.ext.dirs=/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/jre/lib/ext:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext -Xloggc:/home/ekmp/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/home/ekmp/nacos/plugins/health,/home/ekmp/nacos/plugins/cmdb,/home/ekmp/nacos/plugins/mysql -Dnacos.home=/home/ekmp/nacos -jar /home/ekmp/nacos/target/nacos-server.jar --spring.config.location=classpath:/,classpath:/config/,file:./,file:./config/,file:/home/ekmp/nacos/conf/ --logging.config=/home/ekmp/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
,--.
,--.'|
,--,: : | Nacos 1.2.0
,`--.'`| ' : ,---. Running in cluster mode, All function modules
| : : | | ' ,'\ .--.--. Port: 8848
: | \ | : ,--.--. ,---. / / | / / ' Pid: 514550
| : ' '; | / \ / \. ; ,. :| : /`./ Console: http://10.10.71.205:8848/nacos/index.html
' ' ;. ;.--. .-. | / / '' | |: :| : ;_
| | | \ | \__\/: . .. ' / ' | .; : \ \ `. https://nacos.io
' : | ; .' ," .--.; |' ; :__| : | `----. \
| | '`--' / / ,. |' | '.'|\ \ / / /`--' /
' : | ; : .' \ : : `----' '--'. /
; |.' | , .-./\ \ / `--'---'
'---' `--`---' `----'
2021-04-25 13:40:55,976 ERROR read cluster conf fail
java.io.FileNotFoundException: /home/ekmp/nacos/conf/cluster.conf (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at com.alibaba.nacos.core.utils.SystemUtils.readClusterConf(SystemUtils.java:124)
at com.alibaba.nacos.core.listener.StartingSpringApplicationRunListener.logClusterConf(StartingSpringApplicationRunListener.java:142)
at com.alibaba.nacos.core.listener.StartingSpringApplicationRunListener.contextPrepared(StartingSpringApplicationRunListener.java:92)
at org.springframework.boot.SpringApplicationRunListeners.contextPrepared(SpringApplicationRunListeners.java:60)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:374)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
at com.alibaba.nacos.Nacos.main(Nacos.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:593)
2021-04-25 13:40:56,979 INFO Nacos is starting...
2021-04-25 13:40:57,980 INFO Nacos is starting...
2021-04-25 13:40:58,980 INFO Nacos is starting...
2021-04-25 13:40:59,981 INFO Nacos is starting...
2021-04-25 13:41:00,981 INFO Nacos is starting...
2021-04-25 13:41:01,982 INFO Nacos is starting...
2021-04-25 13:41:02,982 INFO Nacos is starting...
解决办法
默认启动的是集群模式
启动服务器
- Linux/Unix/Mac
启动命令(standalone代表着单机模式运行,非集群模式):
sh startup.sh -m standalone
- 如果您使用的是ubuntu系统,或者运行脚本报错提示[[符号找不到,可尝试如下运行:
bash startup.sh -m standalone
- Windows
启动命令(standalone代表着单机模式运行,非集群模式):
startup.cmd -m standalone
方法一
bash -f ./startup.sh -m standalone
方法二
可以修改 startup.sh 头文件,
#!/bin/sh 改成 #!/bin/bash
然后采用 .startup.sh -m standalone & 命令
#!/bin/sh
#! /bin/sh 是指此脚本使用/bin/sh来解释执行
#!是特殊的表示符,如果没有声明,则脚本将在默认的shell中执行,默认shell是由用户所在的系统定义为执行shell脚本的shell.如果脚本被编写为在Kornshell ksh中运行,而默认运行shell脚本的为C shell csh,则脚本在执行过程中很可能失败。
shell编程是以"#“为注释,但对”#!/bin/sh"却不是。"#!/bin/sh"是对shell的声明