一、下载Nacos(快速下载链接:nacos免费)
二、上传至服务器(工具:finalshell),我放的路径为/opt
tar -zxvf nacos-server-1.4.2.tar.gz
# 查看java位置,复制备用
which java
/usr/local/jdk-11/bin/java
# 进入解压后的nacos文件目录下,进入到bin目录下
cd /opt/nacos/bin
# 编辑 vim startup.sh脚本,修改javahome
vim startup.sh
三、执行nacos自带的sql文件
创建数据库,数据库脚本在源码包有,在 nacos/conf/nacos-mysql.sql,把这个导入到数据库中执行后会生成表。
四、编辑 application.properties 修改如下
# 修改配置文件
cd /opt/nacos/conf
vim application.properties
五、单机启动
# 进入
cd /opt/nacos/bin
# 执行./startup.sh -m standalone
[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
六、查看日志(cat /opt/nacos/logs/start.out)
可以看见下面的日志中,内网地址:http://localhost:8848/nacos/index.html
七、默认用户和密码一样:nacos(没关防火墙去关防火墙)
[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://localhost: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
单机部署完成