欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

最好的LNMP配置在0.5G内存的Centos7.0上

程序员文章站 2022-06-16 12:07:02
...
服务器配置

Centos7.0+0.5G内存+1CPU

Web服务器配置

PHP 5.4.16 + Nginx 1.6.3+MariaDB 5.5.44

在上面跑了一个*和一个wordpress,数据库配置文件使用my-small.cnf,但是MariaDB经常挂掉,所以求一个好的配置。

数据库挂掉后,重启MariaDb

启动

systemctl start mariadb

结果

Job for mariadb.service failed. See 'systemctl status mariadb.service' and 'journalctl -xn' for details.

Run

systemctl status mariadb.service

 mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
   Active: failed (Result: exit-code) since 三 2015-11-11 00:42:58 EST; 14s ago
  Process: 10969 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
  Process: 10968 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
  Process: 10941 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 10968 (code=exited, status=0/SUCCESS)
11月 11 00:42:57 jack mysqld_safe[10968]: 151111 00:42:57 mysqld_safe Logging to '/var/lib/mysql/jack.err'.
11月 11 00:42:57 jack mysqld_safe[10968]: 151111 00:42:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
11月 11 00:42:57 jack mysqld_safe[10968]: 151111 00:42:57 mysqld_safe mysqld from pid file /var/lib/mysql/jack.pid ended
11月 11 00:42:58 jack systemd[1]: mariadb.service: control process exited, code=exited status=1
11月 11 00:42:58 jack systemd[1]: Failed to start MariaDB database server.
11月 11 00:42:58 jack systemd[1]: Unit mariadb.service entered failed state.

Run

journalctl -xn

 -- Logs begin at 日 2015-11-08 06:23:57 EST, end at 三 2015-11-11 00:42:58 EST. --
11月 11 00:27:21 jack sshd[10936]: Failed password for invalid user pi from 104.233.81.149 port 53083 ssh2
11月 11 00:27:21 jack sshd[10936]: Received disconnect from 104.233.81.149: 11: Bye Bye [preauth]
11月 11 00:40:43 jack kernel: Ack 2451881106 before 2451884026:2451898626
11月 11 00:42:57 jack systemd[1]: Starting MariaDB database server...
-- Subject: Unit mariadb.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit mariadb.service has begun starting up.
11月 11 00:42:57 jack mysqld_safe[10968]: 151111 00:42:57 mysqld_safe Logging to '/var/lib/mysql/jack.err'.
11月 11 00:42:57 jack mysqld_safe[10968]: 151111 00:42:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
11月 11 00:42:57 jack mysqld_safe[10968]: 151111 00:42:57 mysqld_safe mysqld from pid file /var/lib/mysql/jack.pid ended
11月 11 00:42:58 jack systemd[1]: mariadb.service: control process exited, code=exited status=1
11月 11 00:42:58 jack systemd[1]: Failed to start MariaDB database server.
-- Subject: Unit mariadb.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit mariadb.service has failed.
-- The result is failed.
11月 11 00:42:58 jack systemd[1]: Unit mariadb.service entered failed state.

回复内容:

服务器配置

Centos7.0+0.5G内存+1CPU

Web服务器配置

PHP 5.4.16 + Nginx 1.6.3+MariaDB 5.5.44

在上面跑了一个*和一个wordpress,数据库配置文件使用my-small.cnf,但是MariaDB经常挂掉,所以求一个好的配置。

数据库挂掉后,重启MariaDb

启动

systemctl start mariadb

结果

Job for mariadb.service failed. See 'systemctl status mariadb.service' and 'journalctl -xn' for details.

Run

systemctl status mariadb.service

 mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled)
   Active: failed (Result: exit-code) since 三 2015-11-11 00:42:58 EST; 14s ago
  Process: 10969 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
  Process: 10968 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
  Process: 10941 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 10968 (code=exited, status=0/SUCCESS)
11月 11 00:42:57 jack mysqld_safe[10968]: 151111 00:42:57 mysqld_safe Logging to '/var/lib/mysql/jack.err'.
11月 11 00:42:57 jack mysqld_safe[10968]: 151111 00:42:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
11月 11 00:42:57 jack mysqld_safe[10968]: 151111 00:42:57 mysqld_safe mysqld from pid file /var/lib/mysql/jack.pid ended
11月 11 00:42:58 jack systemd[1]: mariadb.service: control process exited, code=exited status=1
11月 11 00:42:58 jack systemd[1]: Failed to start MariaDB database server.
11月 11 00:42:58 jack systemd[1]: Unit mariadb.service entered failed state.

Run

journalctl -xn

 -- Logs begin at 日 2015-11-08 06:23:57 EST, end at 三 2015-11-11 00:42:58 EST. --
11月 11 00:27:21 jack sshd[10936]: Failed password for invalid user pi from 104.233.81.149 port 53083 ssh2
11月 11 00:27:21 jack sshd[10936]: Received disconnect from 104.233.81.149: 11: Bye Bye [preauth]
11月 11 00:40:43 jack kernel: Ack 2451881106 before 2451884026:2451898626
11月 11 00:42:57 jack systemd[1]: Starting MariaDB database server...
-- Subject: Unit mariadb.service has begun with start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit mariadb.service has begun starting up.
11月 11 00:42:57 jack mysqld_safe[10968]: 151111 00:42:57 mysqld_safe Logging to '/var/lib/mysql/jack.err'.
11月 11 00:42:57 jack mysqld_safe[10968]: 151111 00:42:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
11月 11 00:42:57 jack mysqld_safe[10968]: 151111 00:42:57 mysqld_safe mysqld from pid file /var/lib/mysql/jack.pid ended
11月 11 00:42:58 jack systemd[1]: mariadb.service: control process exited, code=exited status=1
11月 11 00:42:58 jack systemd[1]: Failed to start MariaDB database server.
-- Subject: Unit mariadb.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Unit mariadb.service has failed.
-- The result is failed.
11月 11 00:42:58 jack systemd[1]: Unit mariadb.service entered failed state.