網站首頁 編程語言 正文
1.win10安裝Nginx
nginx下載地址
nginx: download
下載后解壓,進入bin目錄,根據你的系統執行相應的命令
1.1 windows系統啟動和停止的命令
啟動
start nginx.exe
終止
nginx.exe -s stop //停止nginx
nginx.exe -s reload //重新加載nginx
nginx.exe -s quit //退出nginx
2.win10安裝nacos
nacos官網網址
Nacos 快速開始
2.1 搭建三臺nacos步驟
1.復制三份解壓后的nacos文件包分別命名如下
- nacos8848
- nacos8849
- nacos8850
?2.以nacos8848為例,進入該目錄,進入conf目錄修改application.properties文件,使用外置數據源
### Default web server port: server.port=8848 #*************** Network Related Configurations ***************# ### If prefer hostname over ip for Nacos server addresses in cluster.conf: # nacos.inetutils.prefer-hostname-over-ip=false ### Specify local server's IP: # nacos.inetutils.ip-address= #*************** Config Module Related Configurations ***************# ### If use MySQL as datasource: spring.datasource.platform=mysql ### Count of DB: db.num=1 ### Connect URL of DB: db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC db.user.0=root db.password.0=root
3.將conf/cluster.conf.example改為cluster.conf,添加節點配置
#2022-03-23T10:56:12.825 localhost:8849 localhost:8850
4.另外幾臺也照這個配置修改,注意端口號的修改
創建mysql數據庫,sql文件位置:conf\nacos-mysql.sql
5.分別啟動三臺nacos,啟動命令為進入到bin目錄,cmd執行startup.cmd
startup.cmd
6.配置nginx.conf
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; upstream nacoscluster { server localhost:8848; server localhost:8849; server localhost:8850; } server { listen 8847; server_name localhost; location /nacos/ { proxy_pass http://nacoscluster/nacos/; } location = /50x.html { root html; } error_page 500 502 503 504 /50x.html; } server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
7.執行nginx
start nginx.exe
我們監聽的是8847端口,所以我們登錄nacos直接使用nginx進行代理
http://localhost:8847/nacos
我們可以看到當你刷新的時候,分配到的是不同的服務器上
原文鏈接:https://blog.csdn.net/LuckFairyLuckBaby/article/details/123682656
相關推薦
- 2022-12-14 Python桌面文件清理腳本分享_python
- 2022-08-12 C++鏈表實現通訊錄設計_C 語言
- 2022-11-30 jQuery中隱藏元素的hide方法及說明_jquery
- 2022-09-20 關于go-zero單體服務使用泛型簡化注冊Handler路由的問題_Golang
- 2022-07-11 BeanDefinition的作用 及 new ApplicationContext容器的加載過程
- 2022-06-11 FreeRTOS進階之任務切換完全分析_操作系統
- 2022-08-30 Python正則表達式re.compile()和re.findall()詳解_python
- 2022-09-17 Python?pandas?重命名索引和列名稱的實現_python
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支