实业+东莞网站建设,百度小程序如何开发,项目建设背景是什么,婚礼策划网站模板中文目录 一、实验
1.环境 2.Linux 部署 Sentinel
3. 微服务接入Sentinel配置
二、 问题
1.Linux本地启动Sentinel控制台
2.JDBC连接失败 一、实验
1.环境
#xff08;1#xff09;主机
表1 主机
系统软件版本IP备注Linuxopenjdk 1.8.0192.168.204.200 maven3.5.0nac…目录 一、实验
1.环境 2.Linux 部署 Sentinel
3. 微服务接入Sentinel配置
二、 问题
1.Linux本地启动Sentinel控制台
2.JDBC连接失败 一、实验
1.环境
1主机
表1 主机
系统软件版本IP备注Linuxopenjdk 1.8.0192.168.204.200 maven3.5.0nacos1.3.2 依赖jdk 与maven sentinel-dashboard1.8.0 依赖jdkWindowsMySQL8.0.36localhostNavicat 连接 (2) 查看java版本
[rootlocalhost ~]# java -version3查看数据库状态 4微服务引入Sentinel依赖
dependencygroupIdcom.alibaba.cloud/groupIdartifactIdspring-cloud-starter-alibaba-sentinel/artifactId
/dependency 2.Linux 部署 Sentinel
1官网
home | Sentinel 2Github
查看版本
https://github.com/alibaba/Sentinel
控制台
https://github.com/alibaba/Sentinel/wiki/控制台
3下载
wget https://github.com/alibaba/Sentinel/releases/download/v1.8.0/sentinel-dashboard-1.8.0.jar
(4) 启动Sentinel控制台 Sentinel 控制台目前仅支持单机部署需要 JDK 版本为 1.8 及以上版本
//-Dserver.port8080 用于指定 Sentinel 控制台端口为 8080 java -Dserver.port8080 -Dcsp.sentinel.dashboard.server192.168.204.200:8080 -Dproject.namesentinel-dashboard -jar sentinel-dashboard-1.8.0.jar 5 查看进程
[rootlocalhost sysconfig]# ps -ef | grep 8080
root 71819 69264 9 13:33 pts/2 00:00:46 java -Dserver.port8080 -Dcsp.sentinel.dashboard.server192.168.204.200:8080 -Dproject.namesentinel-dashboard -jar sentinel-dashboard-1.8.0.jar
root 72160 71458 0 13:41 pts/3 00:00:00 grep --colorauto 8080 6查看开放的端口
8080端口未开放
[rootlocalhost ~]# iptables -L -n7开放Linux本地的8080端口
[rootlocalhost ~]# cd /etc/sysconfig[rootlocalhost sysconfig]# vim iptables
……-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
…… 8重启服务
[rootlocalhost sysconfig]# service iptables restart9再次查看开放的端口
8080端口已开放
[rootlocalhost sysconfig]# iptables -L -n 10访问
http://192.168.204.200:8080 输入账户密码
默认账号密码 sentinel/sentinel 进入系统 3. 微服务接入Sentinel配置
1模块一修改配置文件
application.yml #dashboard: 8080 控制台端口
#port: 9999 本地启的端口随机选个不能被占用的与dashboard进行数据交互会在应用对应的机器上启动一个 Http Server该 Server 会与 Sentinel 控制台做交互, 若被占用,则开始1一次扫描spring:
……cloud:sentinel:transport:dashboard: 192.168.204.200:8080 port: 9999
……(2) 模块二修改配置文件
application.yml 配置文件与模块一基本相同端口修改为9998
#dashboard: 8080 控制台端口
#port: 9999 本地启的端口随机选个不能被占用的与dashboard进行数据交互会在应用对应的机器上启动一个 Http Server该 Server 会与 Sentinel 控制台做交互, 若被占用,则开始1一次扫描spring:
……cloud:sentinel:transport:dashboard: 192.168.204.200:8080 port: 9998
……3微服务进行Debug 运行 查看 4Nacos查看服务列表 5Sentinel查看
此时没有新增微服务依然为本机的监控 6Postman发送测试 7查看微服务模块一的簇点链路 8查看微服务模块二的簇点链路 9微服务模块二进行流控
点击流控 修改前 修改后阈值修改为2 10查看流控规则 11浏览器快速访问
localhost:9000/api/v1/video/find_by_id?videoId40
出现流量控制 二、 问题
1.Linux本地启动Sentinel控制台
1启动
Sentinel 控制台目前仅支持单机部署需要 JDK 版本为 1.8 及以上版本
//-Dserver.port8080 用于指定 Sentinel 控制台端口为 8080 java -Dserver.port8080 -Dcsp.sentinel.dashboard.serverlocalhost:8080 -Dproject.namesentinel-dashboard -jar sentinel-dashboard-1.8.0.jar 5 查看进程
[rootlocalhost ~]# ps -ef | grep 8080
root 69621 69264 10 13:05 pts/2 00:01:32 java -Dserver.port8080 -Dcsp.sentinel.dashboard.serverlocalhost:8080 -Dproject.namesentinel-dashboard -jar sentinel-dashboard-1.8.0.jar
root 71499 71458 0 13:20 pts/3 00:00:00 grep --colorauto 8080 6访问
http://localhost:8080 输入账户密码
默认账号密码 sentinel/sentinel 进入系统 2.JDBC连接失败
1报错
The server time zone value ?й??????? is unrecognized or represents more than one time zone
2原因分析
因为使用mysql的jdbc驱动最新版6.0时会因为数据库和系统时区差异引起的无法连接问题。
3解决方法
在jdbc的url中加入时区serverTimezone
//CST代表的是中国上海时间与北京时间东八区相同url: jdbc:mysql://127.0.0.1:3306/cloud_order?useUnicodetruecharacterEncodingutf-8useSSLfalseserverTimezoneCST