Trang 1 / 2 12 LastLast
Hiển thị kết quả từ 1 đến 10 / 14
  1. #1
    Tham gia
    03-06-2012
    Bài viết
    345
    Like
    1
    Thanked 41 Times in 32 Posts

    Code restar mysql trong centos

    tình hình con wp của em hay lỗi kết nối dữ liệu, nên e tạo cái crontab cho nó tự động khởi động lại khi lỗi. E lấy code trên mạng, nhưng mà tìm hoài ko biết lý do nó ko chạy được, ae giúp giùm em.

    #!/bin/bash

    # NGINX SECTION
    RESTART="/etc/init.d/nginx restart"
    PGREP="/usr/bin/pgrep"
    NGINX="nginx"
    $PGREP ${NGINX}
    if [ $? -ne 0 ]
    then
    $RESTART
    fi

    # MYSQL SECTION
    RESTARTM="/etc/init.d/mysqld restart"
    MYSQLD="mysqld"
    $PGREP ${MYSQLD}
    if [ $? -ne 0 ]
    then
    $RESTARTM
    fi
    Quote Quote

  2. #2
    Tham gia
    28-11-2008
    Bài viết
    1,007
    Like
    8
    Thanked 41 Times in 32 Posts
    Bạn thử sửa thành
    RESTARTM="service mysqld restart"

  3. #3
    Tham gia
    03-06-2012
    Bài viết
    345
    Like
    1
    Thanked 41 Times in 32 Posts
    Quote Được gửi bởi manlivo View Post
    Bạn thử sửa thành
    RESTARTM="service mysqld restart"
    Nó lỗi đoạn PGREP="/usr/bin/pgrep", báo thư mục ko tồn tại, báo lệnh "fi" lỗi

  4. #4
    Tham gia
    03-06-2012
    Bài viết
    345
    Like
    1
    Thanked 41 Times in 32 Posts
    Mình thông tin thêm là mình xài vps Vultr, dùng app Wordpress, trên hệ điều hành Centos, dùng nginx

  5. #5
    Tham gia
    27-11-2015
    Bài viết
    273
    Like
    8
    Thanked 36 Times in 33 Posts
    Tìm hiểu vấn đề lỗi kết nối mysql và giải quyết. Đừng chọn kiểu khởi động lại như vậy, sẽ có ngày lỗi data. Bạn cho xem log nhé. Sẽ có hướng giải quyết.
    Cuộc đời ngắn ngủi lắm......

  6. #6
    Tham gia
    03-06-2012
    Bài viết
    345
    Like
    1
    Thanked 41 Times in 32 Posts
    [13-May-2018 04:02:02] NOTICE: error log file re-opened
    [14-May-2018 03:31:57] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 24 total children
    [14-May-2018 03:31:58] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 1 idle, and 29 total children
    [14-May-2018 03:32:41] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 40 total children
    [14-May-2018 03:32:42] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 45 total children
    [14-May-2018 03:32:43] WARNING: [pool www] server reached pm.max_children setting (50), consider raising it
    [14-May-2018 03:35:24] WARNING: [pool www] child 1707 exited on signal 9 (SIGKILL) after 176675.355791 seconds from start
    [14-May-2018 03:35:24] NOTICE: [pool www] child 31985 started
    [14-May-2018 03:52:24] NOTICE: fpm is running, pid 1706
    [14-May-2018 03:52:24] NOTICE: ready to handle connections
    [14-May-2018 10:38:41] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 3 idle, and 19 total children
    [14-May-2018 10:38:42] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 4 idle, and 21 total children
    [14-May-2018 15:57:11] NOTICE: fpm is running, pid 1712
    [14-May-2018 15:57:11] NOTICE: ready to handle connections
    [14-May-2018 17:02:07] NOTICE: fpm is running, pid 1722
    [14-May-2018 17:02:07] NOTICE: ready to handle connections
    [14-May-2018 17:08:50] NOTICE: fpm is running, pid 1721
    [14-May-2018 17:08:50] NOTICE: ready to handle connections
    [16-May-2018 22:08:25] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 4 idle, and 29 total children
    [16-May-2018 22:08:39] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 2 idle, and 36 total children
    [16-May-2018 22:08:48] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 3 idle, and 44 total children
    [16-May-2018 22:08:49] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 2 idle, and 46 total children
    [16-May-2018 22:08:55] WARNING: [pool www] child 1801 exited on signal 9 (SIGKILL) after 190704.944966 seconds from start
    [16-May-2018 22:08:55] NOTICE: [pool www] child 394 started
    [16-May-2018 22:08:58] WARNING: [pool www] child 1778 exited on signal 9 (SIGKILL) after 190798.974394 seconds from start
    [16-May-2018 22:08:58] NOTICE: [pool www] child 395 started
    [16-May-2018 22:09:00] WARNING: [pool www] child 1891 exited on signal 9 (SIGKILL) after 190247.716718 seconds from start
    [16-May-2018 22:09:00] NOTICE: [pool www] child 396 started
    [17-May-2018 01:21:05] NOTICE: fpm is running, pid 1716
    [17-May-2018 01:21:06] NOTICE: ready to handle connections
    [17-May-2018 01:30:09] NOTICE: fpm is running, pid 1717
    [17-May-2018 01:30:09] NOTICE: ready to handle connections
    [17-May-2018 02:25:33] NOTICE: Terminating ...
    [17-May-2018 02:25:33] NOTICE: exiting, bye-bye!
    [17-May-2018 02:25:34] NOTICE: fpm is running, pid 4360
    [17-May-2018 02:25:34] NOTICE: ready to handle connections
    [18-May-2018 07:39:23] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 22 total children
    [18-May-2018 07:39:24] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 1 idle, and 27 total children
    [18-May-2018 07:39:25] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 1 idle, and 31 total children
    [18-May-2018 07:39:26] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 1 idle, and 35 total children
    [18-May-2018 07:39:27] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 2 idle, and 39 total children
    [18-May-2018 07:39:28] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 1 idle, and 42 total children
    [18-May-2018 07:39:29] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 2 idle, and 46 total children
    [18-May-2018 07:39:32] WARNING: [pool www] server reached pm.max_children setting (50), consider raising it
    [18-May-2018 07:41:07] WARNING: [pool www] child 14925 exited on signal 9 (SIGKILL) after 101589.618222 seconds from start
    [18-May-2018 07:41:07] NOTICE: [pool www] child 4834 started
    [18-May-2018 07:42:45] WARNING: [pool www] child 4365 exited on signal 9 (SIGKILL) after 105430.948626 seconds from start
    [18-May-2018 07:42:45] NOTICE: [pool www] child 4841 started
    [18-May-2018 08:27:34] WARNING: [pool www] child 4730 exited on signal 9 (SIGKILL) after 2886.139246 seconds from start
    [18-May-2018 08:27:34] NOTICE: [pool www] child 5878 started
    [18-May-2018 08:38:05] WARNING: [pool www] child 4742 exited on signal 9 (SIGKILL) after 3514.024202 seconds from start
    [18-May-2018 08:38:05] NOTICE: [pool www] child 6119 started
    [18-May-2018 08:48:14] WARNING: [pool www] child 4740 exited on signal 9 (SIGKILL) after 4124.977192 seconds from start
    [18-May-2018 08:48:14] NOTICE: [pool www] child 6649 started
    [18-May-2018 09:14:17] NOTICE: fpm is running, pid 1764
    [18-May-2018 09:14:17] NOTICE: ready to handle connections
    [18-May-2018 12:54:39] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 2 idle, and 15 total children
    [18-May-2018 12:54:40] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 18 total children
    [18-May-2018 12:54:41] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 23 total children
    [18-May-2018 12:54:42] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 28 total children
    [18-May-2018 12:54:43] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 2 idle, and 33 total children
    [18-May-2018 12:54:50] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 44 total children
    [18-May-2018 12:54:51] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 49 total children
    [18-May-2018 12:54:52] WARNING: [pool www] server reached pm.max_children setting (50), consider raising it
    [18-May-2018 15:15:04] NOTICE: fpm is running, pid 1758
    [18-May-2018 15:15:04] NOTICE: ready to handle connections
    [18-May-2018 15:19:09] NOTICE: fpm is running, pid 1767
    [18-May-2018 15:19:09] NOTICE: ready to handle connections
    [18-May-2018 17:45:55] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 8 children, there are 0 idle, and 15 total children
    [18-May-2018 17:45:56] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 16 children, there are 0 idle, and 20 total children
    [18-May-2018 17:45:57] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 1 idle, and 25 total children
    [18-May-2018 17:45:58] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 0 idle, and 29 total children
    [18-May-2018 17:45:59] WARNING: [pool www] seems busy (you may need to increase pm.start_servers, or pm.min/max_spare_servers), spawning 32 children, there are 3 idle, and 34 total children
    [18-May-2018 18:07:12] WARNING: [pool www] child 1826 exited on signal 9 (SIGKILL) after 10039.761533 seconds from start
    [18-May-2018 18:07:12] NOTICE: [pool www] child 3483 started
    [18-May-2018 18:37:56] WARNING: [pool www] child 1824 exited on signal 9 (SIGKILL) after 11902.389071 seconds from start
    [18-May-2018 18:37:56] NOTICE: [pool www] child 4046 started
    [18-May-2018 18:48:20] WARNING: [pool www] child 3046 exited on signal 9 (SIGKILL) after 3744.524285 seconds from start
    [18-May-2018 18:48:20] NOTICE: [pool www] child 4641 started
    [18-May-2018 18:48:34] WARNING: [pool www] child 3045 exited on signal 9 (SIGKILL) after 3758.547706 seconds from start
    [18-May-2018 18:48:34] NOTICE: [pool www] child 4708 started
    [18-May-2018 19:06:09] WARNING: [pool www] child 3075 exited on signal 9 (SIGKILL) after 4811.315020 seconds from start
    [18-May-2018 19:06:09] NOTICE: [pool www] child 5587 started
    [18-May-2018 19:37:40] WARNING: [pool www] child 3067 exited on signal 9 (SIGKILL) after 6702.558252 seconds from start
    [18-May-2018 19:37:40] NOTICE: [pool www] child 6213 started

  7. #7
    Tham gia
    03-06-2012
    Bài viết
    345
    Like
    1
    Thanked 41 Times in 32 Posts
    pm.max_children = 50
    pm.start_servers = 5
    pm.min_spare_servers = 5
    pm.max_spare_servers = 35

  8. #8
    Tham gia
    27-11-2015
    Bài viết
    273
    Like
    8
    Thanked 36 Times in 33 Posts
    Cho xin log của nginx_error.log, php-fpm-error.log, php-fpm.log, php-fpm-slow.log nếu có. Thế kia thì khó check quá.
    Cuộc đời ngắn ngủi lắm......

  9. #9
    Tham gia
    28-11-2008
    Bài viết
    1,007
    Like
    8
    Thanked 41 Times in 32 Posts
    Quote Được gửi bởi nhocxitai View Post
    Nó lỗi đoạn PGREP="/usr/bin/pgrep", báo thư mục ko tồn tại, báo lệnh "fi" lỗi
    Vậy bạn gõ thử lệnh "which pgrep" trên vps của bạn xem đường dẫn thế nào?

  10. #10
    Tham gia
    03-06-2012
    Bài viết
    345
    Like
    1
    Thanked 41 Times in 32 Posts
    Quote Được gửi bởi manlivo View Post
    Vậy bạn gõ thử lệnh "which pgrep" trên vps của bạn xem đường dẫn thế nào?
    nó như trên không khác

    - - - Updated - - -

    đó là php-fpm log đó bạn, còn nginx log ko có gì

Trang 1 / 2 12 LastLast

Bookmarks

Quy định

  • Bạn không thể tạo chủ đề mới
  • Bạn không thể trả lời bài viết
  • Bạn không thể gửi file đính kèm
  • Bạn không thể sửa bài viết của mình
  •