linux 为Zabbix配置TiDB数据库

**

环境搭建

**
安装zabbix httpd mysql

安装tidb
官方文档https://www.pingcap.com/docs-cn/QUICKSTART/


[root@localhost bin]# pd-server --data-dir=/data/pd --log-file=/data/logs/pd.log &
[1] 3402
[root@localhost bin]# tikv-server --pd="127.0.0.1:2379" --data-dir=/data/tikv --log-file=/data/logs/tikv.log &
[2] 3410
[root@localhost bin]#  tidb-server --store=tikv --path="127.0.0.1:2379" --log-file=/data/logs/tidb.log &
[3] 3463
[root@localhost bin]# ps ax

 3402 pts/0    Sl     0:00 pd-server --data-dir=/data/pd --log-file=/data/logs/pd.log
 3410 pts/0    Sl     0:14 tikv-server --pd=127.0.0.1:2379 --data-dir=/data/tikv --log-file=/data/logs/tikv.log
 3463 pts/0    Sl     0:00 tidb-server --store=tikv --path=127.0.0.1:2379 --log-file=/data/logs/tidb.log
 3469 pts/0    R+     0:00 ps ax

**

配置数据库

**

[root@localhost zabbix-server-mysql-3.4.6]# mysql -h   127.0.0.1 -P 4000 -uzabbix -pwestos 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.7.1-TiDB-0.9.0 MySQL Community Server (Apache License 2.0)

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| INFORMATION_SCHEMA |
+--------------------+
1 row in set (0.00 sec)

MySQL [(none)]> CREATE DATABASE zabbix CHARSET 'utf8';
Query OK, 0 rows affected (0.34 sec)

MySQL [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'westos';
Query OK, 0 rows affected (0.01 sec)

MySQL [(none)]> show database;
ERROR 1105 (HY000): line 0 column 13 near "" (total length 13)
MySQL [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| INFORMATION_SCHEMA |
| zabbix             |
+--------------------+
2 rows in set (0.00 sec)

MySQL [(none)]> use zabbix;
Database changed
MySQL [zabbix]> show  tables;
Empty set (0.00 sec)

在将数据导入zabbix库
[root@localhost zabbix-server-mysql-3.4.6]# mysql -h   127.0.0.1 -P 4000 -uzabbix -pwestos  zabbix<create.sql
[root@localhost zabbix-server-mysql-3.4.6]# 

导入完成后查看下
Aborted
[root@localhost zabbix-server-mysql-3.4.6]# mysql -h   127.0.0.1 -P 4000 -uzabbix -pwestos 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 20
Server version: 5.7.1-TiDB-0.9.0 MySQL Community Server (Apache License 2.0)

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> use zabbix
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MySQL [zabbix]> show  tables;
+----------------------------+

**************************
| trigger_depends            |
| trigger_discovery          |
| trigger_tag                |
| triggers                   |
| users                      |
| users_groups               |
| usrgrp                     |
| valuemaps                  |
| widget                     |
| widget_field               |
+----------------------------+
140 rows in set (0.00 sec)

MySQL [zabbix]> 


**

配置httpd以及zabbix

**

其他配置与前一部分相同
注意添加端口即可
DBPort=4000

添加php脚本
[root@localhost web]# vim  zabbix.conf.php 
[root@localhost web]# pwd
/etc/zabbix/web


<?php
// Zabbix GUI  configuration  file
global  $DB;

$DB['TYPE']     = 'MYSQL';
$DB['SERVER']   = '127.0.0.1';  
$DB['PORT']     = '4000';
$DB['DATABASE'] = 'zabbix';
$DB['USER']     = 'zabbix';
$DB['PASSWORD'] = 'westos';

//  Schema name. Used for  IBM DB2 and PostgreSQL.

$DB['SCHEMA']='';

$ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT ='10051';
$ZBX_SERVER_NAME ='zabbixServer';

$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;

启动服务登陆浏览器配置即可

这里写图片描述

这里写图片描述

等待可用性变为绿色即可
这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值