合 使用OBD部署一个OceanBase 三副本集群并使用Promethues监控OB(在不同节点)
Tags: 高可用监控环境搭建OceanBaseGrafana分布式数据库
安装OBAgent
OBAgent 是用 GO 语言开发的监控采集框架,通常部署在 OBServer 节点上。OBAgent 支持推、拉两种数据采集模式,可以满足不同的应用场景。OBAgent 默认支持的插件包括主机数据采集、OceanBase 数据库指标的采集、监控数据标签处理和 Prometheus 协议的 HTTP 服务。要使 OBAgent 支持其他数据源的采集,或者自定义数据的处理流程,您只需要开发对应的插件即可。
参考:https://open.oceanbase.com/docs/tutorials/quickstart/V1.0.0/2-9-how-to-deploy-obagent
编辑 OBAgent 部署配置文件
OBAgent 部署配置文件可以跟 OceanBase 集群部署配置文件一起,也可以后期单独部署。
下面示例是采用单独的配置文件部署 OBAgent 。OBAgent 的部署配置文件风格跟 OceanBase 集群部署配置文件一样。 首先是指定部署节点,包括节点名称和 IP 。节点名称保持唯一就行,可以是主机名(假设主机名是唯一的)。 然后指定全局配置。各个节点共同的配置都放在 global
节下。节点定制化的配置就不用放在这个下面。 然后指定各个节点定制化的配置。比如说每个节点的 zone
名称是不一样的。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | cat > /tmp/obd_obagent_only.yaml <<"EOF" ## Only need to configure when remote login is required user: username: admin password: lhr key_file: obagent: servers: # Please don't use hostname, only IP can be supported - name: observer01 ip: 172.72.8.11 # OB1 地址 - name: observer02 ip: 172.72.8.12 # OB2 地址 - name: observer03 ip: 172.72.8.13 # OB3 地址 global: # The working directory for obagent. obagent is started under this directory. This is a required field. home_path: /home/admin/obagent # The port that pulls and manages the metrics. The default port number is 8088. server_port: 8088 # Debug port for pprof. The default port number is 8089. pprof_port: 8089 # Log level. The default value is INFO. log_level: INFO # Log path. The default value is log/monagent.log. log_path: log/monagent.log # Encryption method. OBD supports aes and plain. The default value is plain. crypto_method: plain # Path to store the crypto key. The default value is conf/.config_secret.key. # crypto_path: conf/.config_secret.key # Size for a single log file. Log size is measured in Megabytes. The default value is 30M. log_size: 30 # Expiration time for logs. The default value is 7 days. log_expire_day: 7 # The maximum number for log files. The default value is 10. log_file_count: 10 # Whether to use local time for log files. The default value is true. # log_use_localtime: true # Whether to enable log compression. The default value is true. # log_compress: true # Username for HTTP authentication. The default value is admin. http_basic_auth_user: admin # Password for HTTP authentication. The default value is root. http_basic_auth_password: lhr # Username for debug service. The default value is admin. pprof_basic_auth_user: admin # Password for debug service. The default value is root. pprof_basic_auth_password: lhr # Monitor username for OceanBase Database. The user must have read access to OceanBase Database as a system tenant. The default value is root. monitor_user: root # Monitor password for OceanBase Database. The default value is empty. When a depends exists, OBD gets this value from the oceanbase-ce of the depends. The value is the same as the root_password in oceanbase-ce. monitor_password: lhr # The SQL port for observer. The default value is 2881. When a depends exists, OBD gets this value from the oceanbase-ce of the depends. The value is the same as the mysql_port in oceanbase-ce. sql_port: 2881 # The RPC port for observer. The default value is 2882. When a depends exists, OBD gets this value from the oceanbase-ce of the depends. The value is the same as the rpc_port in oceanbase-ce. rpc_port: 2882 # Cluster name for OceanBase Database. When a depends exists, OBD gets this value from the oceanbase-ce of the depends. The value is the same as the appname in oceanbase-ce. cluster_name: lhrob312cluster # Cluster ID for OceanBase Database. When a depends exists, OBD gets this value from the oceanbase-ce of the depends. The value is the same as the cluster_id in oceanbase-ce. cluster_id: 1 # Zone name for your observer. The default value is zone1. When a depends exists, OBD gets this value from the oceanbase-ce of the depends. The value is the same as the zone name in oceanbase-ce. zone_name: zone1 # Monitor status for OceanBase Database. Active is to enable. Inactive is to disable. The default value is active. When you deploy an cluster automatically, OBD decides whether to enable this parameter based on depends. ob_monitor_status: active # Monitor status for your host. Active is to enable. Inactive is to disable. The default value is active. host_monitor_status: active # Whether to disable the basic authentication for HTTP service. True is to disable. False is to enable. The default value is false. disable_http_basic_auth: false # Whether to disable the basic authentication for the debug interface. True is to disable. False is to enable. The default value is false. disable_pprof_basic_auth: false observer01: zone: zone1 observer02: zone: zone2 observer03: zone: zone3 EOF |
注意: