首页 > 代码库 > 完整部署CentOS7.2+OpenStack+kvm 云平台记录(2)---错误排查
完整部署CentOS7.2+OpenStack+kvm 云平台记录(2)---错误排查
在上传镜像或查看镜像的时候,报错:
[root@linux-node1 ~]# glance image-list
500 Internal Server Error: The server has either erred or is incapable of performing the requested operation. (HTTP 500)
测试登陆数据库:
[root@linux-node1 ~]# mysql -u glance -h 192.168.1.17 -p
Enter password:
ERROR 1040 (08004): Too many connections 果然登陆数据库的时候有问题!!!
解决办法,这也是centos7下修改mysql连接数的做法:
参考:http://blog.csdn.net/hnhuangyiyang/article/details/51132141
(1)临时修改
MariaDB [(none)]> set GLOBAL max_connections=1000;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> show variables like "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 1000 |
+-----------------+-------+
1 row in set (0.00 sec)
(2)永久修改:
配置/etc/my.cnf
[mysqld]新添加一行如下参数:
max_connections=1000
重启mariadb服务,再次查看mariadb数据库最大连接数,可以看到最大连接数是214,并非我们设置的1000。
MariaDB [(none)]> show variables like ‘max_connections‘;
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 214 |
+-----------------+-------+
这是由于mariadb有默认打开文件数限制。可以通过配置/usr/lib/systemd/system/mariadb.service来调大打开文件数目。
配置/usr/lib/systemd/system/mariadb.service
[Service]新添加两行如下参数:
LimitNOFILE=10000
LimitNPROC=10000
重新加载系统服务,并重启mariadb服务
systemctl --system daemon-reload
systemctl restart mariadb.service
再次查看mariadb数据库最大连接数,可以看到最大连接数已经是1000
MariaDB [(none)]> show variables like ‘max_connections‘;
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 1000 |
+-----------------+-------+
到此,问题就迎刃而解了!!
完整部署CentOS7.2+OpenStack+kvm 云平台记录(2)---错误排查