Internal Server Error в Nextcloud

Print Friendly, PDF & Email

Задача:

Убрать ошибку “Internal Server Error” в Nextcloud

---------------------------------------------------------------

Уже сталкивался с ошибкой в статье “Ошибка nextcloud — Internal Server Error“, в этот раз попробую разобрать решение проблемы более детально.

Ошибка появилась после отключения питания на сервере

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

Немного информации о сервере:

  • FreeBSD 13.0 release p4
  • Nginx 1.20.1
  • PHP 8.0.11
  • MariaDB 10.5.12
  • Redis 6.0.15
  • memcached
  • APCu
  • OPcache

Кеширование Nextcloud (часть конфига nextcloud)

  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'filelocking.enabled' => 'true',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/tmp/redis.sock',
    'port' => 0,
    'dbindex' => 0,
    'password' => '5e49d5aa132cc547847847849ba6c62c295730dbac10',
    'timeout' => 1.5,
  ),

Я сразу проверил службы отвечающие за кеш

root@cloud:/ # service memcached status
memcached is running as pid 1013.
root@cloud:/ # service redis status
redis is not running.
root@cloud:/ #

Проверяем конфиг Редиса

root@cloud:/ # cat /usr/local/etc/redis.conf | grep -v '^#' | grep -v '^$' | grep -v '^;'
protected-mode yes
tcp-backlog 511
unixsocket /tmp/redis.sock
unixsocketperm 766
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /var/run/redis/redis.pid
loglevel notice
logfile /var/log/redis/redis.log
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/db/redis/
requirepass 5e49d5aa132cc547847847849ba6c62c295730dbac10
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
root@cloud:/ #

Проверяем лог Redis

root@cloud:/ # cat /var/log/redis/redis.log

853:C 27 Oct 2021 20:53:04.227 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
853:C 27 Oct 2021 20:53:04.227 # Redis version=6.0.15, bits=64, commit=00000000, modified=0, pid=853, just started
853:C 27 Oct 2021 20:53:04.227 # Configuration loaded
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 6.0.15 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 853
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

853:M 27 Oct 2021 20:53:04.230 # Server initialized
853:M 27 Oct 2021 20:53:04.231 # Short read or OOM loading DB. Unrecoverable error, aborting now.
853:M 27 Oct 2021 20:53:04.231 # Internal error in RDB reading offset 0, function at rdb.c:2405 -> Unexpected EOF reading RDB file
root@cloud:/ #

Проверяем каталог

root@cloud:/ # ls -lh /var/db/redis/
total 348
-rw-r--r--  1 redis  redis     0B Oct 27 14:41 dump.rdb
-rw-r--r--  1 redis  redis   348K Oct 27 14:41 temp-79488.rdb
root@cloud:/ #

Файлы .rdb – это дампы на диске для резервного копирования или сохранения. Их можно безопасно удалить, конечно в рамках решения проблем c nextcloud, ну а сама база данных Redis полностью находится в памяти. 

Удаляем файлы и пробуем запустить

root@cloud:/ # service redis start
Starting redis.
root@cloud:/ # service redis status
redis is not running.
root@cloud:/ # rm /var/db/redis/*
root@cloud:/ # ls -lh /var/db/redis/
total 0
root@cloud:/ # service redis start
Starting redis.
root@cloud:/ # service redis status
redis is running as pid 1462.
root@cloud:/ # ls -lh /var/db/redis/
total 0
root@cloud:/ # service redis stop
Stopping redis.
Waiting for PIDS: 1462.
root@cloud:/ # ls -lh /var/db/redis/
total 8
-rw-r--r--  1 redis  redis   4.8K Oct 27 22:52 dump.rdb
root@cloud:/ # service redis start
Starting redis.
root@cloud:/ #

Как видим, dump файл заново создался. Проверяем работу Nextcloud, всё работает

root@cloud:/ # sudo -u www php /usr/local/www/nextcloud/occ status
The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php
  - installed: true
  - version: 22.2.0.2
  - versionstring: 22.2.0
  - edition:
root@cloud:/ #
Помогла статья? Есть возможность отблагодарить автора

QR Link:

QR Code

Вам может также понравиться...

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *