Nagios监控mysql从库报错: libmysqlclient.so.18: cannot open shared object file: No such

来源:互联网 发布:蚂蜂窝连app接不到网络 编辑:程序博客网 时间:2024/05/29 16:30
做mysql的slave监控的时候,需要check_mysql脚本,check的时候报错:
 error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

1,错误信息如下:
[root@slave ~]# /usr/local/nagios/libexec/check_mysql -uadmin -P3306 -S /data/mbdata/open/mysql.sock -H127.0.0.1 -pxxxxx -d openshop -w 300 -c 360
/usr/local/nagios/libexec/check_mysql: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
[root@slave ~]#

2,执行check_mysql --help看下命令,发现也不行。
  1. [root@slave ~]# /usr/local/nagios/libexec/check_mysql --help  
  2. /usr/local/nagios/libexec/check_mysql: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory  
  3. [root@slave ~]#   

3,查看一下报错的libmysqlclient.so.18文件是否存在:
[root@db-m1-slave-1 ~]# find / -name libmysqlclient.so.18
/mysql-5.6.12/libmysql/libmysqlclient.so.18
/usr/local/mysql/lib/libmysqlclient.so.18
文件存在,但是无法识别。


4,可能是libmysqlclient的问题
搜索mysqlclient library linkage problem。
找到文章地址:http://stackoverflow.com/questions/2080679/mysqlclient-library-linkage-problem
发现有/etc/ld.so.conf.d/mysql-x86_64.conf这样一个配置文件,打开看看
cat /etc/ld.so.conf.d/mysql-x86_64.conf

[root@slave ~]# cat /etc/ld.so.conf.d/mysql-x86_64.conf
/usr/lib64/mysql

进入目录/usr/lib64/mysql查看下有什么文件:
[root@slave ~]# ll /usr/lib64/mysql
总用量 3108
lrwxrwxrwx. 1 root root      26 9月  29 2013 libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0
-rwxr-xr-x. 1 root root 1595176 12月  8 2012 libmysqlclient_r.so.16.0.0
lrwxrwxrwx. 1 root root      24 9月  29 2013 libmysqlclient.so.16 -> libmysqlclient.so.16.0.0
-rwxr-xr-x. 1 root root 1582952 12月  8 2012 libmysqlclient.so.16.0.0
有一些软连接,而且带了后缀表示so.16之类的,但是没有so.18之类,看来是没有连接到这里,
可能是需要做一个软连接把/usr/local/mysql/lib/libmysqlclient.so.18变成/usr/lib64/libmysqlclient.so.18,
马上去做软连接:ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18,然后再check下,check成功如下所示:


  1. [root@slave ~]# ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18  
  2. [root@slave ~]  
  3. [root@slave ~]  
  4. [root@slave ~]# /usr/local/nagios/libexec/check_mysql --help  
  5. check_mysql v2.0 (nagios-plugins 2.0)  
  6. Copyright (c) 1999-2014 Nagios Plugin Development Team  
  7.     <devel@nagios-plugins.org>  
  8. This program tests connections to a MySQL server  
  9. Usage:  
  10.  check_mysql [-d database] [-H host] [-P port] [-s socket]  
  11.        [-u user] [-p password] [-S] [-l] [-a cert] [-k key]  
  12.        [-C ca-cert] [-D ca-dir] [-L ciphers] [-f optfile] [-g group]  
  13.   
  14.   
  15. Options:  
  16.  -h, --help  
  17.     Print detailed help screen  
  18.  -V, --version  
  19.     Print version information  
  20.  --extra-opts=[section][@file]  
  21.     Read options from an ini file. See  
  22.     https://www.nagios-plugins.org/doc/extra-opts.html  
  23.     for usage and examples.  
  24. ..................................  
  25. -l, --ssl  
  26.     Use ssl encryptation  
  27.  -C, --ca-cert=STRING  
  28.     Path to CA signing the cert  
  29.  -a, --cert=STRING  
  30.     Path to SSL certificate  
  31.  -k, --key=STRING  
  32.     Path to private SSL key  
  33.  -D, --ca-dir=STRING  
  34.     Path to CA directory  
  35.  -L, --ciphers=STRING  
  36.     List of valid SSL ciphers  
  37. .................................................  
  38. Send email to help@nagios-plugins.org if you have questions regarding use  
  39. of this software. To submit patches or suggest improvements, send email to  
  40. devel@nagios-plugins.org  
  41.   
  42.   
  43. [root@slave ~]  

5,继续执行check_mysql来check一下
[root@slave ~]# /usr/local/nagios/libexec/check_mysql -unagios -P3306 -S -H127.0.0.1 --password='xxx@0512' /usr/local/mysql/mysql.sock -d test -w 60 -c 100
slave query error: Access denied; you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation
[root@slave ~]# 
报账号错误,
check
slave query error: Access denied; you need (at least one of) the SUPER, REPLICATION CLIENT privilege(s) for this operation
账号错误,进入mysql界面赋予nagios账号权限
mysql> GRANT PROCESS, SUPER, REPLICATION CLIENT ON *.* TO nagios@'%' identified by 'xxx@0512';

6,再check
[root@slave ~]# /usr/local/nagios/libexec/check_mysql -unagios -P3306 -S -Hlocalhost --password='xxx@0512' -s /usr/local/mysql/mysql.sock -d test -w 60 -c 100
Slave IO: Yes Slave SQL: No Seconds Behind Master: (null)

mysql slave 检测失败,有错误信息:Slave IO: Yes Slave SQL: No Seconds Behind Master: (null)

进mysql窗口去看详细信息

  1. [root@slave ~]# mysql  
  2. Welcome to the MySQL monitor.  Commands end with ; or \g.  
  3. Your MySQL connection id is 23  
  4. Server version: 5.6.12-log Source distribution  
  5.   
  6. Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.  
  7.   
  8. Oracle is a registered trademark of Oracle Corporation and/or its  
  9. affiliates. Other names may be trademarks of their respective  
  10. owners.  
  11.   
  12. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.  
  13.   
  14. mysql> show slave status\G  
  15. *************************** 1. row ***************************  
  16.                Slave_IO_State: Waiting for master to send event  
  17.                   Master_Host: 10.xx.3.xx  
  18.                   Master_User: repl  
  19.                   Master_Port: 3306  
  20.                 Connect_Retry: 60  
  21.               Master_Log_File: mysql-bin.010294  
  22.           Read_Master_Log_Pos: 21764  
  23.                Relay_Log_File: mysql-relay-bin.003125  
  24.                 Relay_Log_Pos: 91805  
  25.         Relay_Master_Log_File: mysql-bin.010275  
  26.              Slave_IO_Running: Yes  
  27.             Slave_SQL_Running: No  
  28.               Replicate_Do_DB: xx,xx_db,xxsystem  
  29.           Replicate_Ignore_DB:   
  30.            Replicate_Do_Table:   
  31.        Replicate_Ignore_Table:   
  32.       Replicate_Wild_Do_Table:   
  33.   Replicate_Wild_Ignore_Table:   
  34.                    Last_Errno: 1590  
  35.                    Last_Error: The incident LOST_EVENTS occured on the master. Message: error writing to the binary log  
  36.                  Skip_Counter: 0  
  37.           Exec_Master_Log_Pos: 91642  
  38.               Relay_Log_Space: 1780004  
  39.               Until_Condition: None  
  40.                Until_Log_File:   
  41.                 Until_Log_Pos: 0  
  42.            Master_SSL_Allowed: No  
  43.            Master_SSL_CA_File:   
  44.            Master_SSL_CA_Path:   
  45.               Master_SSL_Cert:   
  46.             Master_SSL_Cipher:   
  47.                Master_SSL_Key:   
  48.         Seconds_Behind_Master: NULL  
  49. Master_SSL_Verify_Server_Cert: No  
  50.                 Last_IO_Errno: 0  
  51.                 Last_IO_Error:   
  52.                Last_SQL_Errno: 1590  
  53.                Last_SQL_Error: The incident LOST_EVENTS occured on the master. Message: error writing to the binary log  
  54.   Replicate_Ignore_Server_Ids:   
  55.              Master_Server_Id: 71  
  56.                   Master_UUID: 9b0dcf62-29f4-11e3-9471-677b33903869  
  57.              Master_Info_File: mysql.slave_master_info  
  58.                     SQL_Delay: 0  
  59.           SQL_Remaining_Delay: NULL  
  60.       Slave_SQL_Running_State:   
  61.            Master_Retry_Count: 86400  
  62.                   Master_Bind:   
  63.       Last_IO_Error_Timestamp:   
  64.      Last_SQL_Error_Timestamp: 140512 11:29:54  
  65.                Master_SSL_Crl:   
  66.            Master_SSL_Crlpath:   
  67.            Retrieved_Gtid_Set:   
  68.             Executed_Gtid_Set:   
  69.                 Auto_Position: 0  
  70. 1 row in set (0.00 sec)  
  71. mysql>   

关于Slave IO: Yes Slave SQL: No Seconds Behind Master: (null),参考blog:  http://blog.csdn.net/mchdba/article/details/25738991


7,slave重做之后,再check,slave状态是正常的。

# /usr/local/nagios/libexec/check_mysql -unagios -P3306 -S -s /usr/local/mysql/mysql.sock -Hlocalhost --password='xxx@0512' -d test -w 60 -c 100 

  1. [root@slave ~]# /usr/local/nagios/libexec/check_mysql -unagios -P3306 -S -s /usr/local/mysql/mysql.sock -Hlocalhost --password='xxx@0512' -d test -w 60 -c 100   
  2. Uptime: 18431321  Threads: 3  Questions: 1447646  Slow queries: 735  Opens: 18605  Flush tables: 1  Open tables: 214  Queries per second avg: 0.078 Slave IO: Yes Slave SQL: Yes Seconds Behind Master: 0|Connections=1380c;;; Open_files=32;;; Open_tables=214;;; Qcache_free_memory=66980240;;; Qcache_hits=778c;;; Qcache_inserts=5338c;;; Qcache_lowmem_prunes=0c;;; Qcache_not_cached=12516c;;; Qcache_queries_in_cache=34;;; Queries=1447647c;;; Questions=99727c;;; Table_locks_waited=0c;;; Threads_connected=1;;; Threads_running=1;;; Uptime=18431321c;;; 'seconds behind master'=0.000000s;60.000000;100.000000;  
  3. [root@db-m1-slave-1 ~]#   
0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 大学通选课挂科怎么办 通识必修课挂了怎么办 我想开3d艺术馆怎么办 档案回原籍报到证怎么办 服刑的人孩子上学怎么办 长沙终身教育网用户名忘记了怎么办 乡下卖服装没生意怎么办 没能力没学历该怎么办 没有学历的我该怎么办 补过的牙掉了怎么办 法院判完被告不给钱怎么办 b证到期未继续教育怎么办 宝宝上幼儿园中午要用尿不湿怎么办 嫁到北京农村怎么办居住证 2020年没脱贫的农民怎么办 2020年农民的土地怎么办 车停在停车场被划怎么办 专升本差两分怎么办 入职需要学士学位证怎么办 不喜欢写科研项目又没编制怎么办 易学堂密码忘了怎么办 易班手机号换了怎么办 易班登录不上怎么办 易到手机号换了怎么办 海外留学没有教育部认证怎么办 七过月宝宝便秘怎么办 6个月孩子便秘怎么办 6个月婴儿便秘怎么办 一个多月宝宝两天没拉大便怎么办 7个月宝宝便秘怎么办 9个月宝宝便秘怎么办 六个月宝宝严重便秘怎么办 公司调岗员工不同意怎么办 acca注册一直在审核怎么办 ieee ap二审被拒怎么办 文章投到假期刊怎么办 论文投了假网站怎么办 网上传了虚假的怎么办? 网上做兼职被骗了钱怎么办 通过支付宝扫码被骗了怎么办 支付宝扫二维码被骗怎么办