nacos1.4.2的下载路径:Release 1.4.2 (Apr 29th, 2021) · alibaba/nacos · GitHub
tar -zxvf nacos-server-1.4.2.tar.gz
cd /opt/nacos/nacos/bin
[root@master ~]# which java
/usr/local/jdk-11/bin/java
vim startup.sh
cd /opt/nacos/nacos/conf
vim application.properties
[root@master bin]# ./startup.sh -m standalone
/usr/local/jdk-11/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Xlog:gc*:file=/opt/nacos/nacos/logs/nacos_gc.log:time,tags:filecount=10,filesize=102400 -Dloader.path=/opt/nacos/nacos/plugins/health,/opt/nacos/nacos/plugins/cmdb -Dnacos.home=/opt/nacos/nacos -jar /opt/nacos/nacos/target/nacos-server.jar --spring.config.additional-location=file:/opt/nacos/nacos/conf/ --logging.config=/opt/nacos/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
nacos is starting with standalone
nacos is starting,you can check the /opt/nacos/nacos/logs/start.out
[root@master bin]# cat /opt/nacos/nacos/logs/start.out
/usr/local/jdk-11/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Xlog:gc*:file=/opt/nacos/nacos/logs/nacos_gc.log:time,tags:filecount=10,filesize=102400 -Dloader.path=/opt/nacos/nacos/plugins/health,/opt/nacos/nacos/plugins/cmdb -Dnacos.home=/opt/nacos/nacos -jar /opt/nacos/nacos/target/nacos-server.jar --spring.config.additional-location=file:/opt/nacos/nacos/conf/ --logging.config=/opt/nacos/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
,--.
,--.'|
,--,: : | Nacos 1.4.2
,`--.'`| ' : ,---. Running in stand alone mode, All function modules
| : : | | ' ,'\ .--.--. Port: 8848
: | \ | : ,--.--. ,---. / / | / / ' Pid: 4575
| : ' '; | / \ / \. ; ,. :| : /`./ Console: http://192.168.106.141:8848/nacos/index.html
' ' ;. ;.--. .-. | / / '' | |: :| : ;_
| | | \ | \__\/: . .. ' / ' | .; : \ \ `. https://nacos.io
' : | ; .' ," .--.; |' ; :__| : | `----. \
| | '`--' / / ,. |' | '.'|\ \ / / /`--' /
' : | ; : .' \ : : `----' '--'. /
; |.' | , .-./\ \ / `--'---'
'---' `--`---' `----'
2022-09-14 17:38:28,648 INFO Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler@73386d72' of type [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-09-14 17:38:28,651 INFO Bean 'methodSecurityMetadataSource' of type [org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-09-14 17:38:28,973 INFO Tomcat initialized with port(s): 8848 (http)
2022-09-14 17:38:29,288 INFO Root WebApplicationContext: initialization completed in 2967 ms
2022-09-14 17:38:30,951 INFO Initializing ExecutorService 'applicationTaskExecutor'
2022-09-14 17:38:31,072 INFO Adding welcome page: class path resource [static/index.html]
2022-09-14 17:38:31,328 INFO Creating filter chain: Ant [pattern='/**'], []
2022-09-14 17:38:31,351 INFO Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@20580d4e, org.springframework.security.web.context.SecurityContextPersistenceFilter@3fa21d49, org.springframework.security.web.header.HeaderWriterFilter@91f565d, org.springframework.security.web.csrf.CsrfFilter@4ed5a1b0, org.springframework.security.web.authentication.logout.LogoutFilter@57e388c3, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@6e31d989, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@65bb6275, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@21bd128b, org.springframework.security.web.session.SessionManagementFilter@3cd26422, org.springframework.security.web.access.ExceptionTranslationFilter@67b355c8]
2022-09-14 17:38:31,413 INFO Initializing ExecutorService 'taskScheduler'
2022-09-14 17:38:31,430 INFO Exposing 2 endpoint(s) beneath base path '/actuator'
2022-09-14 17:38:31,523 INFO Tomcat started on port(s): 8848 (http) with context path '/nacos'
2022-09-14 17:38:31,526 INFO Nacos started successfully in stand alone mode. use external storage
cd /lib/systemd/system
touch nacos.service
[Unit]
Description=nacos
After=network.target
[Service]
Type=forking
ExecStart=/usr/nacos-server-1.1.3/nacos/bin/startup.sh -m standalone
ExecReload=/usr/nacos-server-1.1.3/nacos/bin/shutdown.sh
ExecStop=/usr/nacos-server-1.1.3/nacos/bin/shutdown.sh
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable nacos.service
systemctl is-enabled nacos.service
systemctl start nacos.service
systemctl status nacos.service
完整的代码展示
[root@master bin]# vim startup.sh
[root@master bin]# systemctl daemon-reload
[root@master bin]# systemctl enable nacos.service
[root@master bin]# systemctl is-enabled nacos.service
enabled
[root@master bin]# systemctl start nacos.service
[root@master bin]# systemctl status nacos.service
● nacos.service - nacos
Loaded: loaded (/usr/lib/systemd/system/nacos.service; enabled; vendor preset: disabled)
Active: active (running) since 四 2022-09-15 09:42:39 CST; 5s ago
Process: 1577 ExecStart=/opt/nacos/nacos/bin/startup.sh -m standalone (code=exited, status=0/SUCCESS)
CGroup: /system.slice/nacos.service
└─1601 /usr/local/jdk-11/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Xlog:gc*:file=/opt/nacos/nacos/...
9月 15 09:42:39 master systemd[1]: Starting nacos...
9月 15 09:42:39 master startup.sh[1577]: /usr/local/jdk-11/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Xlog:g...
9月 15 09:42:39 master startup.sh[1577]: nacos is starting with standalone
9月 15 09:42:39 master startup.sh[1577]: nacos is starting,you can check the /opt/nacos/nacos/logs/start.out
9月 15 09:42:39 master systemd[1]: Started nacos.
Hint: Some lines were ellipsized, use -l to show in full.
下面这篇文章有问题,按照他的步骤会报错,我在他基础上改了代码
参考:linux 设置nacos开机启动