YoY*_*oYo 1 ubuntu redis ubuntu-16.04
操作系统:Ubuntu 16.04
我想在Digitalocean的512mb RAM VPS服务器上安装redis-server,我重新执行命令,我得到了,
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 311316 files and directories currently installed.)
Preparing to unpack .../libisc-export160_1%3a9.10.3.dfsg.P4-
8ubuntu1.9_amd64.deb ...
Unpacking libisc-export160 (1:9.10.3.dfsg.P4-8ubuntu1.9) over
(1:9.10.3.dfsg.P4-8ubuntu1.7) ...
dpkg: unrecoverable fatal error, aborting:
fork failed: Cannot allocate memory
E: Sub-process /usr/bin/dpkg returned an error code (2)
Run Code Online (Sandbox Code Playgroud)
我跑了sudo dpkg --configure -a和sudo apt-get -f install,我得到了
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libisc-export160
The following packages will be upgraded:
libisc-export160
1 upgraded, 0 newly installed, 0 to remove and 169 not upgraded.
1 not fully installed or removed.
Need to get 0 B/153 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 311316 files and directories currently installed.)
Preparing to unpack .../libisc-export160_1%3a9.10.3.dfsg.P4-
8ubuntu1.9_amd64.deb ...
E: Sub-process /usr/bin/dpkg returned an error code (2)
Run Code Online (Sandbox Code Playgroud)
我检查了空间
man@pay:$ free -t
total used free shared buff/cache available
Mem: 500060 352068 76032 5800 71960 114020
Swap: 0 0 0
Total: 500060 352068 76032
Run Code Online (Sandbox Code Playgroud)
我需要安装redis-server软件包吗?
dpkg: unrecoverable fatal error, aborting:
fork failed: Cannot allocate memory
Run Code Online (Sandbox Code Playgroud)
这意味着您没有足够的内存来执行该操作。
通过执行以下命令刷新文件系统缓冲区:
$ sync
Run Code Online (Sandbox Code Playgroud)
现在再试一次。
如果仍然遇到相同的问题,请按照以下步骤操作。要释放页面缓存:
$ echo 1 > /proc/sys/vm/drop_caches
Run Code Online (Sandbox Code Playgroud)
要释放牙科和智能节点:
$ echo 2 > /proc/sys/vm/drop_caches
Run Code Online (Sandbox Code Playgroud)
要释放页面缓存,牙科和索引节点:
$ echo 3 > /proc/sys/vm/drop_caches
Run Code Online (Sandbox Code Playgroud)
现在再试一次。
使用redis服务器时,使用RDB快照时可能会出现问题。为了进行写入,请使用BGSAVE命令,该命令会分叉当前进程,并在此分叉中将数据写入磁盘。因此,主线程不会被阻塞,并且写入将异步发生。问题在于,在UNIX系统上,当调用fork()时,子进程还将复制父进程使用的内存内容。假设,如果Redis当前占用2Gb的内存,并且系统中仅剩1Gb的可用内存,则在执行BGSAVE命令时可能会发生以下错误:
# Can't save in background: fork: Cannot allocate memory
Run Code Online (Sandbox Code Playgroud)
在现代系统中,为分叉复制内存时,使用“写时复制”方法。仅当记录到相应部分时才复制存储器。Redis只是为了异步保存数据而执行进程的派生,此派生不会以任何方式更改它们,因此我们可以安全地将vm.overcommit_memory系统参数设置为1。该参数负责分配更多数据的可能性。可用内存不足。在/etc/sysctl.conf中添加一行:
vm.overcommit_memory = 1
Run Code Online (Sandbox Code Playgroud)
并重新读取配置:
# sysctl -p
Run Code Online (Sandbox Code Playgroud)
详细说明:
http://linuxamination.blogspot.com/2013/05/dpkg-unrecoverable-fatal-error-aborting.html
https://habrahabr.ru/post/140893/
| 归档时间: |
|
| 查看次数: |
2274 次 |
| 最近记录: |