1、安装redis,并启动
1)准备安装和数据目录
[root@efk ~]# mkdir -p /data/soft
[root@efk ~]# mkdir -p /opt/redis_cluster/redis_6379/{conf,logs,pid}
2)下载redis安装包
[root@efk ~]# cd /data/soft
[root@efk soft]# wget http://download.redis.io/releases/redis-5.0.7.tar.gz
3)解压redis到/opt/redis_cluster/
[root@efk soft]# tar xf redis-5.0.7.tar.gz -C /opt/redis_cluster/
[root@efk soft]# ln -s /opt/redis_cluster/redis-5.0.7 /opt/redis_cluster/redis
4)切换目录安装redis
[root@efk soft]# cd /opt/redis_cluster/redis
[root@efk redis]# make && make install
5)编写配置文件
[root@efk redis]# vim /opt/redis_cluster/redis_6379/conf/6379.conf
bind 127.0.0.1 192.168.1.128
port 6379
daemonize yes
pidfile /opt/redis_cluster/redis_6379/pid/redis_6379.pid
logfile /opt/redis_cluster/redis_6379/logs/redis_6379.log
databases 16
dbfilename redis.rdb
dir /opt/redis_cluster/redis_6379
6)启动当前redis服务
[root@efk redis]# redis-server /opt/redis_cluster/redis_6379/conf/6379.conf
登录redis,查看键值
[root@efk ~]# redis-cli
2)配置logstash
[root@efk soft]# vim /etc/logstash/conf.d/redis.conf
#添加:
input {
redis {
host => “192.168.1.128”
port => “6379”
db => “0”
key => “filebeat”
data_type => “list”
}
}
filter {
mutate {
convert => [“upstream_time”,“float”]
convert => [“request_time”,“float”]
}
}
output {
stdout {}
elasticsearch {
hosts => [“http://192.168.1.128:9200”]
index => “nginx_access-%{+YYYY.MM.dd}”
manage_template => false
}
}
3)
启动logstash
systemctl start logstash
一、zabbix监控mysql四大性能指标
查询吞吐量
查询执行性能
连接情况
缓冲池使用情况
二、吞吐量
Com_select:select查询语句个数/每秒
Com_insert:insert操作语句个数/每秒
Com-update:update操作语句个数/每秒
Com-delete:delete操作语句个数/每秒
Questions:查询语句总量
mysqladmin -uread -p123456 -h47.98.97.124 extended-status | grep Com_select
| Com_select | 18484 |
mysqladmin -uread -p123456 -h47.98.97.124 extended-status | grep Com_update
| Com_update | 3000 |
mysqladmin -uread -p123456 -h47.98.97.124 extended-status | grep Com_insert
| Com_insert | 1054 |
mysqladmin -uread -p123456 -h47.98.97.124 extended-status | grep Com_delete
| Com_delete | 198 |
mysqladmin -uread -p123456 -h47.98.97.124 extended-status | grep Questions
| Questions | 723868 |
三、查询性能
Slow_queries:慢查询数量
mysqladmin -uread -p123456 -h47.98.97.124 extended-status | grep Slow_queries
| Slow_queries | 0 |
四、连接情况
Threads_connected:当前打开的数据库连接数
max_connections:数据库当前的最大连接数
mysqladmin -uread -p123456 -h47.98.97.124 extended-status | grep -i connect
| Aborted_connects | 0 |
| Connections | 572 |
| Max_used_connections | 4 |
| Ssl_client_connects | 0 |
| Ssl_connect_renegotiates | 0 |
| Ssl_finished_connects | 0 |
| Threads_connected | 2 |
zabbix 发送报警邮件
Zabbix监控服务器、客户端都已经部署完成,被监控主机已添加完成,Zabbix监控运行正常。
2、安装邮件发送工具mailx 。(邮件用户代理MUA)
[root@ssticentos65 ~]# yum -y install mailx #在线安装mailx
3、 配置mail
[root@ssticentos65 ~]# vim /etc/mail.rc
set from=lg1871212539@sina.com #新浪注册的个人邮箱,用于zabbi服务端转发邮件到指定邮箱
set smtp=smtp.sina.com #填写新浪发送邮箱服务器地址smtp
set smtp-auth-user= lg1871212539 #新浪个人邮箱用户
set smtp-auth-password=lg123456 #新浪个人邮箱密码
set smtp-auth=login #登录
4、测试邮件能否发送
#发送一份邮件到3243948235@qq.com 这个QQ邮箱(个人申请的QQ测试邮箱)
[root@ssticentos65 ~]# echo “test” | mail -s ‘test linux’ 1873714157@qq.com