oceanbase部署--使用OBD部署obagent和promethous_grafana软件

obagent

OBAgent 通常部署在 OBServer 节点上。OBAgent支持推、拉两种数据采集模式,可以满足不同的应用场景。
OBAgent默认支持的插件包括主机数据采集、OceanBase 数据库指标的采集、监控数据标签处理和 Prometheus 协议的 HTTP 服务。

1)编辑 OBAgent 部署配置文件obagent-only.yaml

OBAgent 部署配置文件可以跟 OceanBase 集群部署配置文件部署在一起,也可以后期单独部署,此处为单独部署。

vim obagent-only.yaml
obagent:
  servers:
    - name: obce01
      ip: 192.168.152.30
    - name: obce02
      ip: 192.168.152.31
    - name: obce03
      ip: 192.168.152.32
  global:
    home_path: /home/admin/obagent
    server_port: 8088
    pprof_port: 8089
    sql_port: 3881
    rpc_port: 3882
    log_level: INFO
    log_path: log/monagent.log
    crypto_method: plain
    log_size: 30
    log_expire_day: 7
    log_file_count: 10
    http_basic_auth_user: admin
    http_basic_auth_password: eIYf7NAZeT
    pprof_basic_auth_user: admin
    pprof_basic_auth_password: eIYf7NAZeT
    monitor_user: monitor
    monitor_password: fLyaqjrp2R
    cluster_name: obcluster-3zones
  obce01: 
    zone: zone1 
  obce02: 
    zone: zone2 
  obce03: 
    zone: zone3

注意:
1.指定节点的连接端口用的是 sql_port ,跟 OBServer 配置文件里的 mysql_port对应。
2. 监控用户(monitor_user 对应)和密码需要在 sys 租户下创建。

创建monitor用户并授权
obclient -h 192.168.152.30 -uroot@sys#obcluster-3zones -P3883 -p0EI5N08d -c -A oceanbase

执行如下操作:
SHOW GRANTS FOR monitor;
grant select on oceanbase.* to monitor identified by 'fLyaqjrp2R'; #和配置文件里密码一致

然后再次查看monitor用户权限,结果如下:
MySQL [oceanbase]> SHOW GRANTS FOR monitor;
+--------------------------------------------+
| Grants for monitor@%                       |
+--------------------------------------------+
| GRANT USAGE ON *.* TO 'monitor'            |
| GRANT SELECT ON `oceanbase`.* TO 'monitor' |
+--------------------------------------------+
2 rows in set (0.190 sec)

2)使用obd部署obagent

wget https://mirrors.aliyun.com/oceanbase/community/stable/el/8/x86_64/obagent-1.2.0-4.el8.x86_64.rpm
su - admin
obd mirror clone /tmp/obsoft/obagent-1.2.0-4.el8.x86_64.rpm
obd cluster deploy obagent-only -c obagent-only.yaml
obd cluster start obagent-only
部署完成,查看和验证obagent
[admin@obce01 ~]$ obd cluster list
+--------------------------------------------------------------------------------+
|                                  Cluster List                                  |
+------------------+-------------------------------------------+-----------------+
| Name             | Configuration Path                        | Status (Cached) |
+------------------+-------------------------------------------+-----------------+
| obce-single      | /home/admin/.obd/cluster/obce-single      | destroyed       |
| obcluster-3zones | /home/admin/.obd/cluster/obcluster-3zones | running         |
| obagent-only     | /home/admin/.obd/cluster/obagent-only     | running         |
+------------------+-------------------------------------------+-----------------+
[admin@obce01 ~]$ obd cluster display obagent-only
Get local repositories and plugins ok
Open ssh connection ok
Cluster status check ok
+----------------------------------------------------+
|                      obagent                       |
+----------------+-------------+------------+--------+
| ip             | server_port | pprof_port | status |
+----------------+-------------+------------+--------+
| 192.168.152.30 | 8088        | 8089       | active |
| 192.168.152.31 | 8088        | 8089       | active |
| 192.168.152.32 | 8088        | 8089       | active |
+----------------+-------------+------------+--------+


使用curl测试agent :密码在配置文件中提前配置了
curl --user admin:eIYf7NAZeT -L 'http://192.168.152.31:8088/metrics/ob/basic'

3)obagnet重启

i.直接重启某个节点的 OBAgent:
   kill -9 `pidof monagent`
   cd /home/admin/obagent && nohup bin/monagent -c conf/monagent.yaml &
   
ii.如果是集中重启,使用 OBD 命令重启:
   obd cluster restart obagent_only
   
iii.如果 OBAgent 是跟 OceanBase 一起部署的,则只能重启 obagent 组件:
   obd cluster restart obce-3zones-obagent -c obagent

4)部署prometheus

OBAgent 启动后会自动生成 Prometheus 配置文件,被放在 OBAgent
安装目录下(/home/admin/obagent/conf/prometheus_config/)。可供 Prometheus直接使用。

scrape_interval 1s 抓取间隔
evaluation_interval 10s 评估规则间隔
rule_files rules/*rules.yaml 报警规则
scrape_configs – 抓取配置

prometheus下载https://prometheus.io/download/

解压安装并启动

tar zxvf prometheus-xxxxxxxx.linux-amd64.tar.gz 
cp /home/admin/obagent/conf/prometheus_config/promethous.yaml /home/admin/prometheus-2.37.5.linux-amd64/
./prometheus  ---config.file=prometheus.yaml &

netstat -nltp 可以看到9090端口开着
浏览器直接访问192.168.152.30:9090/graph

5)grafana安装

下载安装:

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

使用:

sudo systemctl start grafana-server.service
http://192.168.152.30:3000/login  
     admin/admin
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值