脚本宝典收集整理的这篇文章主要介绍了SpringCloud-Spring Cloud Alibaba Nacos集群架构(Day11),脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
############################################################
spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos_config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true
db.user=root
db.password=123456
cp cluster.comf.example cluster.conf
192.168.0.135:3333
192.168.0.135:4444
192.168.0.135:5555
while getopts ":m:f:s:p:" opt
do
case $opt in
m)
MODE=$OPTARG;;
f)
FUNCTION_MODE=$OPTARG;;
s)
SERVER=$OPTARG;;
p)
PORT=$OPTARG;;
?)
echo "Unknown parameter"
exit 1;;
esac
done
# start
echo "$JAVA ${JAVA_OPT}" > ${BASE_DIR}/logs/start.out 2>&1 &
nohup $JAVA -Dserver.port=${PORT} ${JAVA_OPT} nacos.nacos >> ${BASE_DIR}/logs/start.out 2>&1 &
echo "nacos is starting,you can check the ${BASE_DIR}/logs/start.out"
~/Downloads/nacos/bin/ ./startup.sh -p 3333
/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/bin/java -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/guochongling/Downloads/nacos/logs/java_heapdump.hprof -XX:-UseLargePages -Djava.ext.dirs=/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/ext:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/lib/ext:/Users/guochongling/Downloads/nacos/plugins/cmdb:/Users/guochongling/Downloads/nacos/plugins/mysql -Xloggc:/Users/guochongling/Downloads/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dnacos.home=/Users/guochongling/Downloads/nacos -Dloader.path=/Users/guochongling/Downloads/nacos/plugins/health -jar /Users/guochongling/Downloads/nacos/target/nacos-server.jar --spring.config.location=classpath:/,classpath:/config/,file:./,file:./config/,file:/Users/guochongling/Downloads/nacos/conf/ --logging.config=/Users/guochongling/Downloads/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
nacos is starting with cluster
nacos is starting,you can check the /Users/guochongling/Downloads/nacos/logs/start.out
~/Downloads/nacos/bin/ ./startup.sh -p 4444
/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/bin/java -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/guochongling/Downloads/nacos/logs/java_heapdump.hprof -XX:-UseLargePages -Djava.ext.dirs=/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/ext:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/lib/ext:/Users/guochongling/Downloads/nacos/plugins/cmdb:/Users/guochongling/Downloads/nacos/plugins/mysql -Xloggc:/Users/guochongling/Downloads/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dnacos.home=/Users/guochongling/Downloads/nacos -Dloader.path=/Users/guochongling/Downloads/nacos/plugins/health -jar /Users/guochongling/Downloads/nacos/target/nacos-server.jar --spring.config.location=classpath:/,classpath:/config/,file:./,file:./config/,file:/Users/guochongling/Downloads/nacos/conf/ --logging.config=/Users/guochongling/Downloads/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
nacos is starting with cluster
nacos is starting,you can check the /Users/guochongling/Downloads/nacos/logs/start.out
~/Downloads/nacos/bin/ ./startup.sh -p 5555
/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/bin/java -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/Users/guochongling/Downloads/nacos/logs/java_heapdump.hprof -XX:-UseLargePages -Djava.ext.dirs=/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/jre/lib/ext:/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home/lib/ext:/Users/guochongling/Downloads/nacos/plugins/cmdb:/Users/guochongling/Downloads/nacos/plugins/mysql -Xloggc:/Users/guochongling/Downloads/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dnacos.home=/Users/guochongling/Downloads/nacos -Dloader.path=/Users/guochongling/Downloads/nacos/plugins/health -jar /Users/guochongling/Downloads/nacos/target/nacos-server.jar --spring.config.location=classpath:/,classpath:/config/,file:./,file:./config/,file:/Users/guochongling/Downloads/nacos/conf/ --logging.config=/Users/guochongling/Downloads/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
nacos is starting with cluster
nacos is starting,you can check the /Users/guochongling/Downloads/nacos/logs/start.out
~/Downloads/nacos/bin/
~/Downloads/nacos/bin/ ps -ef | grep nacos|grep -v grep|wc -l
3
~/Downloads/nacos/bin/
我使用的是Macos为了能够安装方便一点,我就使用Homebrew安装nginx。考虑到大家在使用Homebrew中间可能会遇到一些问题,我这里就重点说明一下。
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
macOS安装Homebrew时总是报错(Failed to connect to raw.githubusercontent.com port 443: Connection refused),由于一些因素,导致GitHub的raw.githubusercontent.com域名解析被污染了。解决办法如下
brew install nginx
~/ brew info nginx
nginx: stable 1.21.4, HEAD
HTTP(S) server and reverse proxy, and IMAP/POP3 proxy server
https://nginx.org/
/usr/local/Cellar/nginx/1.21.4 (11 files, 2.1MB) *
Built from source on 2021-12-17 at 09:09:15
From: https://mirrors.ustc.edu.cn/homebrew-core.git/Formula/nginx.rb
License: BSD-2-Clause
==> Dependencies
Required: openssl@1.1 ✔, pcre ✔
==> Options
--HEAD
Install HEAD version
==> Caveats
Docroot is: /usr/local/var/www
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /usr/local/etc/nginx/servers/.
To restart nginx after an upgrade:
brew services restart nginx
Or, if you don't want/need a background service you can just run:
/usr/local/opt/nginx/bin/nginx -g daemon off;
==> Analytics
install: 36,449 (30 days), 121,098 (90 days), 504,359 (365 days)
install-on-request: 36,406 (30 days), 120,869 (90 days), 503,241 (365 days)
build-error: 56 (30 days)
~/
open -a finder /usr/local/etc/nginx
#gzip on;
upstream cluster{
server 127.0.0.1:3333;
server 127.0.0.1:4444;
server 127.0.0.1:5555;
}
server {
listen 8848;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root html;
#index index.html index.htm;
proxy_pass http://cluster;
}
~/ nginx
lsof -i tcp:port
kill -9 pid
以上是脚本宝典为你收集整理的SpringCloud-Spring Cloud Alibaba Nacos集群架构(Day11)全部内容,希望文章能够帮你解决SpringCloud-Spring Cloud Alibaba Nacos集群架构(Day11)所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。