部署Nacos的源碼環(huán)境搭建過程
正文
最近在學習nacos,通過調式源碼查看服務注冊和發(fā)現流程和原理,本地部署naos源碼需要一定的步驟,本文主要做nacos源碼部署。
nacos版本:2.1.1
下載源碼
從github上下載源碼到本地,下載下圖的源碼包,
地址為https://github.com/alibaba/nacos/releases/tag/2.1.1

解壓后用idea打開源碼,com.alibaba.nacos.consistency.entity報紅錯誤:

編譯
解決com.alibaba.nacos.consistency.entity報紅問題,編譯總項目。在目錄nacos-2.1.1打開終端編譯整個項目:
mvn compile
啟動
啟動類
找到console項目中的Nacos啟動類。

設置單機啟動
啟動類配置VM options添加參數,設置成單機啟動:
-Dnacos.standalone=true
啟動輸出
有以下輸出,說明項目啟動成功:
,--.
,--.'|
,--,: : | Nacos
,`--.'`| ' : ,---. Running in stand alone mode, All function modules
| : : | | ' ,'\ .--.--. Port: 8848
: | \ | : ,--.--. ,---. / / | / / ' Pid: 7184
| : ' '; | / \ / \. ; ,. :| : /`./ Console: http://192.168.3.181:8848/nacos/index.html
' ' ;. ;.--. .-. | / / '' | |: :| : ;_
| | | \ | \__\/: . .. ' / ' | .; : \ \ `. https://nacos.io
' : | ; .' ," .--.; |' ; :__| : | `----. \
| | '`--' / / ,. |' | '.'|\ \ / / /`--' /
' : | ; : .' \ : : `----' '--'. /
; |.' | , .-./\ \ / `--'---'
'---' `--`---' `----'
2023-01-11 11:20:45.576 INFO 7184 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8848 (http)
2023-01-11 11:20:45.716 INFO 7184 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1964 ms
2023-01-11 11:20:48.151 INFO 7184 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html]
2023-01-11 11:20:48.402 WARN 7184 --- [ main] o.s.s.c.a.web.builders.WebSecurity : You are asking Spring Security to ignore Ant [pattern='/**']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.
2023-01-11 11:20:48.402 INFO 7184 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Will not secure Ant [pattern='/**']
2023-01-11 11:20:48.418 INFO 7184 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@637c8632, org.springframework.security.web.context.SecurityContextPersistenceFilter@7c4a5ef2, org.springframework.security.web.header.HeaderWriterFilter@3055f310, org.springframework.security.web.csrf.CsrfFilter@7901a5ab, org.springframework.security.web.authentication.logout.LogoutFilter@7a2fd94c, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@34d3409d, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@2f64f99f, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@156eeff1, org.springframework.security.web.session.SessionManagementFilter@7d7c05fa, org.springframework.security.web.access.ExceptionTranslationFilter@288b8663]
2023-01-11 11:20:48.433 INFO 7184 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint(s) beneath base path '/actuator'
2023-01-11 11:20:48.465 INFO 7184 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8848 (http) with context path '/nacos'
2023-01-11 11:20:48.480 INFO 7184 --- [ main] c.a.n.c.l.StartingApplicationListener : Nacos started successfully in stand alone mode. use embedded storage
2023-01-11 11:20:48.752 INFO 7184 --- [)-192.168.3.181] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2023-01-11 11:20:48.752 INFO 7184 --- [)-192.168.3.181] o.s.web.servlet.DispatcherServlet : Completed initialization in 0 ms
查看控制臺
請求http://127.0.0.1:8848/nacos,查看控制臺。

以上就是部署Nacos的源碼環(huán)境搭建過程的詳細內容,更多關于Nacos源碼部署環(huán)境搭建的資料請關注腳本之家其它相關文章!
相關文章
SpringBoot字段注入和構造函數注入的區(qū)別及說明
這篇文章主要介紹了SpringBoot字段注入和構造函數注入的區(qū)別及說明,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2025-04-04
詳解Spring Boot使用系統(tǒng)參數表提升系統(tǒng)的靈活性
Spring Boot項目中常有一些相對穩(wěn)定的參數設置項,其作用范圍是系統(tǒng)級的或模塊級的,這些參數稱為系統(tǒng)參數。這些變量以參數形式進行配置,從而提高變動和擴展的靈活性,保持代碼的穩(wěn)定性2021-06-06

