shell> tail /var/log/httpd/ssl_error_log [Mon Mar 28 10:49:19 2016] [warn] RSA server certificate CommonName (CN) `localhost' does NOT match server name!? [Mon Mar 28 10:49:19 2016] [error] Unable to configure RSA server private key [Mon Mar 28 10:49:19 2016] [error] SSL Library Error: 185073780 error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch
知道是SSL相关的问题之后,马上打开/var/log/httpd/ssl_error_log查看情况,有如下报错[warn] RSA server certificate CommonName (CN)localhost’ does NOT match server name!?` 当看到这一行报错的时候,已经确认上面猜测的第一点,就是Apache的默认配置文件加载了mod_ssl模块,而且指定密钥对儿的位置,就是我测试salt-api时创建密钥对儿的位置。而且还有一个错误就是我密钥对儿指定的hostname和Apache指定的hostname并不相同,基于密钥对主机名不符与密钥过期两点,造成了Apache无法启动的故障。
external_auth: pam: thatch: - '@wheel' # to allow access to all wheel modules - '@runner' # to allow access to all runner modules - '@jobs' # to allow access to the jobs runner and/or wheel module
shell> python sa.py Traceback (most recent call last): File "sa.py", line 25, in <module> test() File "sa.py", line 17, intest response = urllib2.urlopen(request) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open response = self._open(req, data) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open '_open', req) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain result = func(*args) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1240, in https_open context=self._context) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1197, in do_open raise URLError(err) urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>
shell> mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) shell> service mysqld restart Stopping mysqld: [ OK ] MySQL Daemon failed to start. Starting mysqld: [FAILED] #日志中报错如下: [ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade. [ERROR] Aborting #这种情况本人是在MySQL5.1到5.7版本升级时遇到的,升级到5.7后,数据库启动失败 #解决的办法就是重新初始化数据库 shell> rm -fr /var/lib/mysql shell> mysqld --initialize --user=mysql shell> service mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ]
mysql-files文件问题
1 2 3 4 5 6 7 8 9 10
#MySQL启动失败,日志中报错如下: [ERROR] Failed to access directory for --secure-file-priv. Please make sure that directory exists and is accessible by MySQL Server. Supplied value : /var/lib/mysql-files
#造成这种情况可能是因为mysql-files文件夹不存在或权限错误 #解决办法如下: shell> touch /var/lib/mysql-files shell> chown mysql:mysql /var/lib/mysql-files shell> service mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ]
shell> yum remove mysql Loaded plugins: fastestmirror Setting up Remove Process Resolving Dependencies --> Running transaction check ---> Package mysql.x86_64 0:5.1.73-5.el6_6 will be erased --> Processing Dependency: mysql = 5.1.73-5.el6_6 for package: mysql-server-5.1.73-5.el6_6.x86_64 --> Running transaction check ---> Package mysql-server.x86_64 0:5.1.73-5.el6_6 will be erased --> Finished Dependency Resolution
Dependencies Resolved
===================================================================================== Package Arch Version Repository Size ===================================================================================== Removing: mysql x86_64 5.1.73-5.el6_6 @base 2.4 M Removing for dependencies: mysql-server x86_64 5.1.73-5.el6_6 @base 25 M
Installed size: 27 M Is this ok [y/N]: #卸载老版本的MySQL,默认会同时卸载掉对应的client端
#执行上面的安装部分...
#启动数据库可能会出现下面的错误 shell> service mysqld restart Stopping mysqld: [ OK ] MySQL Daemon failed to start. Starting mysqld: [FAILED]
shell> mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) #查看日志出现如下报错 #[ERROR] Fatal error: mysql.user table is damaged. Please run mysql_upgrade. #解决方法是重新初始化数据库 shell> rm -fr /var/lib/mysql shell> mysqld --initialize --user=mysql shell> service mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ]
shell> mysql -uroot -p<password> mysql> create database zabbix character set utf8 collate utf8_bin; mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>'; mysql> quit; shell> cd database/mysql #在解压缩后的zabbix-3.0.0文件夹中 shell> mysql -uzabbix -p<password> zabbix < schema.sql #如果你是为Zabbix Proxy来创建数据库,那么到这里就必须停止了,下面的不需要执行 shell> mysql -uzabbix -p<password> zabbix < images.sql shell> mysql -uzabbix -p<password> zabbix < data.sql
在打开的页面中看到“Welcome to Zabbix 3.0”几个大字就算成功了一半了!点击Next step
第二个页面Check of pre-requisites 会检查PHP的一些配置参数(第一列是变量名;第二列是PHP配置文件实际值;第三项是Zabbix强制要求的最低值或固定值),默认情况下这个页面所有的检查项应该都是“OK”的,如果有红色的错误项,根据前面提示的变量名,去找PHP的配置文件,修改成“REQUIRED”要求的值就可以啦(默认PHP的配置文件/etc/php.ini)
第三个页面Configure DB connection 这一步骤会去尝试连接数据库。第一项数据库类型选择MySQL;DB Host 保持默认的localhost(因为这里采用了AIO的安装方式,数据库没有单独分离);DB Port修改成3306;DB Name:zabbix; User:zabbix;Password:zabbix。点击Next step如果出现报错,根据报错信息排查是否是配置错误(这些配置都是在前面设置过的,3306是MySQL默认的端口号)
第四个页面Zabbix server details 保持默认的Host:localhost和Port:10051配置即可,Name可以自定义设置,为这套监控系统起个名字
第六个页面Install 我在进入到这个页面后,出现了报错,提示Can not create the configuration file 下方官方也给出了手动解决这个问题的方法。按照提示,第一步点击给出的连接,下载zabbix官方提供的配置文件;第二步,根据提示,放在指定的位置保存为指定的文件,我这里提示保存为:/usr/share/zabbix/conf/zabbix.conf.php 按照提示操作完成后点击Finish
shell> yum install --enablerepo=remi php php-gd ... --> Processing Dependency: libt1.so.5()(64bit) for package: php-gd-5.4.45-4.el6.remi.x86_64 --> Finished Dependency Resolution Error: Package: php-gd-5.4.45-4.el6.remi.x86_64 (remi) Requires: libt1.so.5()(64bit) You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
[root@MasterDatabase ~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 161391 Server version: 5.1.73-log Source distribution
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | | zabbix | +--------------------+ 4 rows in set (0.00 sec)
mysql> create user 'wordpress'@'%' identified by 'wordpress'; Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on wordpress.* to 'wordpress'@'%'; Query OK, 0 rows affected (0.00 sec)
创建用户: CREATE USER 'username'@'host' IDENTIFIED BY 'password';
CREATE USER 'username'@'192.168.5.9' IDENTIFIED BY 'password'; CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; CREATE USER 'username'@'%' IDENTIFIED BY ''; CREATE USER 'username'@'%';
授权: GRANT privileges ON databasename.tablename TO 'username'@'host';
GRANT SELECT,INSERT ON DBname.tablename TO 'username'@'%'; GRANT ALL ON DBname.tablename TO 'username'@'%'; GRANT ALL ON DBname.* TO 'username'@'%'; GRANT ALL ON *.* TO 'username'@'%'; 注意:使用以上命令授权的用户不能用来再给其他用户授权 如果想让该用户可以为其他用户授权,可以使用如下命令: GRANT privileges ON databasename.tablename TO 'username'@'host' WITH GRANT OPTION;
设置/更改用户密码 SET PASSWORD FOR 'username'@'host'=PASSWORD('newpassword'); 如果是修改当前登录的用户的密码,使用如下命令: SET PASSWDORD=PASSWORD('newpassword')