暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

「YashanDB个人版体验」配置Prometheus监控YashanDB

原创 y 2023-11-28
432

一、前言

开源监控软件Prometheus配置YashanDB监控的示例,方便DBA通过监控面板更方便查看YashanDB各指标项


二、介质准备

  1. YashanDB安装包地址:

登录:https://download.yashandb.com/download 选择:YashanDB Personal 23.1(根据虚机CPU架构自行选择x86或者arm)

  1. Prometheus下载地址:

https://github.com/prometheus/prometheus/releases/download/v2.48.0/prometheus-2.48.0.linux-amd64.tar.gz

  1. Grafana下载地址:

sudo yum install -y https://dl.grafana.com/enterprise/release/grafana-enterprise-10.2.2-1.x86_64.rpm

  1. yashandb_exporter

下载地址:https://www.modb.pro/doc/121615

三、数据库安装

--1.上传包并解压 [root@localhost ~]# su - yashan [yashan@localhost ~]$ mkdir install [yashan@localhost ~]$ tar -xf yashandb-personal-23.1.1.100-linux-x86_64.tar.gz -C install [yashan@localhost ~]$ cd install/ --2.生成参数文件 [yashan@localhost install]$ ./bin/yasboot package se gen --cluster yashandb -u yashan -p yashan --ip 192.168.3.169 --port 22 --install-path /home/yashan/yasdb_home --data-path /home/yashan/yasdb_data --begin-port 1688 hostid | group | node_type | node_name | listen_addr | replication_addr | data_path -------------------------------------------------------------------------------------------------------------- host0001 | dbg1 | db | 1-1 | 192.168.3.169:1688 | 192.168.3.169:1689 | /home/yashan/yasdb_data ----------+-------+-----------+-----------+--------------------+--------------------+------------------------- Generate config success --3.执行安装 [yashan@localhost install]$ ./bin/yasboot package install -t hosts.toml -i /home/yashan/yashandb-personal-23.1.1.100-linux-x86_64.tar.gz checking install package... install version: yashandb 23.1.1.100 host0001 100% [====================================================================] 3s update host to yasom... --4.执行部署 [yashan@localhost install]$ ./bin/yasboot cluster deploy -t yashandb.toml type | uuid | name | hostid | index | status | return_code | progress | cost ------------------------------------------------------------------------------------------------------------ task | 9fa85141733402db | DeployYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 9 ------+------------------+--------------------+--------+----------+---------+-------------+----------+------ task completed, status: SUCCESS --5.环境变量配置 [yashan@localhost install]$ cd /home/yashan/yasdb_home/yashandb/23.1.1.100/conf/ [yashan@localhost conf]$ cat yashandb.bashrc >> ~/.bashrc [yashan@localhost conf]$ source ~/.bashrc --6.查看数据库状态 [yashan@localhost conf]$ yasboot cluster status -c yashandb host_id | node_type | nodeid | pid --------------------------------------- host0001 | db | 1-1:1 | 21315 ----------+-----------+--------+------- --7.登录数据库(如下登录方式需要配置操作系统免密登录,请参考:https://doc.yashandb.com/yashandb/23.1/zh/%E4%BA%A7%E5%93%81%E5%AE%89%E5%85%A8/%E7%94%A8%E6%88%B7%E5%8F%8A%E8%AE%A4%E8%AF%81/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E8%AE%A4%E8%AF%81%E7%AE%A1%E7%90%86/%E9%85%8D%E7%BD%AE%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E8%AE%A4%E8%AF%81.html) [yashan@localhost conf]$ yasql / as sysdba YashanDB SQL Personal Edition Release 23.1.1.100 x86_64 Connected to: YashanDB Server Personal Edition Release 23.1.1.100 x86_64 - X86 64bit Linux SQL>


四、Prometheus安装并启动

--解压 [root@localhost ~]# mkdir /soft/prometheus [root@localhost prometheus]# tar -xf prometheus-2.48.0.linux-amd64.tar.gz [root@localhost prometheus]# cd prometheus-2.48.0.linux-amd64 --编辑配置文件prometheus.yml,追加如下内容 - job_name: 'yashandb' # 静态添加node static_configs: # 指定监控端 - targets: ['192.168.3.169:9161'] labels: instance: 192.168.3.169:1688 --启动 [root@localhost prometheus-2.48.0.linux-amd64]# nohup ./prometheus &


五、Grafana安装

#两种方式 #1.在线安装,运行yum install [root@localhost prometheus]# sudo yum install -y https://dl.grafana.com/enterprise/release/grafana-enterprise-10.2.2-1.x86_64.rpm #2.离线安装,下载安装包,上传/soft/prometheus目录 [root@localhost prometheus]# yum install -y grafana-enterprise-10.2.2-1.x86_64.rpm #确认Grafana是否安装成功 [root@localhost prometheus]# ps -ef|grep grafana grafana 26958 1 8 11:17 ? 00:00:04 /usr/share/grafana/bin/grafana server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packaging=rpm cfg:default.paths.logs=/var/log/grafana cfg:default.paths.data=/var/lib/grafana cfg:default.paths.plugins=/var/lib/grafana/plugins cfg:default.paths.provisioning=/etc/grafana/provisioning root 27030 18103 0 11:18 pts/1 00:00:00 grep --color=auto grafana


六、配置YashanDB Exporter

--上传包至/soft/prometheus目录并解压 [root@localhost prometheus]# chmod 775 -R /soft/prometheus [root@localhost prometheus]# chown -R yashan:yashan yashandb_exporter.zip [root@localhost prometheus]# su - yashan [yashan@localhost ~]$ cd /soft/prometheus/ [yashan@localhost prometheus]$ unzip yashandb_exporter.zip [yashan@localhost yashandb_exporter-1.0.linux-amd64]$ chmod +x yashandb_exporter encrypt --创建监控连接用户,此处为演示直接赋dba权限给dbmonitor [yashan@localhost yashandb_exporter-1.0.linux-amd64]$ yasql / as sysdba Connected to: YashanDB Server Personal Edition Release 23.1.1.100 x86_64 - X86 64bit Linux SQL> create user dbmonitor identified by "j8a3(xkT"; Succeed. SQL> grant dba to dbmonitor; Succeed. --编辑配置文件yashandb_exporter.ini [yashan@localhost yashandb_exporter-1.0.linux-amd64]$ cat yashandb_exporter.ini [yashandb] ip = 192.168.3.169 port = 1688 user = dbmonitor passwd = "j8a3(xkT" [exporter] listen_addr = 0.0.0.0:9161 --启动服务 [yashan@localhost yashandb_exporter-1.0.linux-amd64]$ sh start.sh [yashan@localhost yashandb_exporter-1.0.linux-amd64]$ nohup: redirecting stderr to stdout

七、登录Grafana面板

登录地址:192.168.3.169:3000

默认账号/密码:admin/admin

配置数据源:





导入YashanDB-Overview.json

解压yashandb_exporter.zip可发现此文件

文件路径:/soft/prometheus/yashandb_exporter-1.0.linux-amd64/YashanDB-Overview.json

最后查看面板:


八、总结

普罗米修斯作为开源监控工具,能很好的监控主机资源,结合对主机资源以及崖山数据库的监控,能直观的了解到崖山数据库的各项数据库指标及数据库负载程度,提升崖山数据库的运维效率。

最后修改时间:2023-12-08 17:27:15
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论