Docker CentOS Installation Redis and problem handling

Source: Internet
Author: User
Tags redis version docker centos

A previous article Redis installation and master-slave configuration describes the installation configuration of Redis, and another document describes the Docker CentOS installation openssh. Combine two papers today-build a Redis cache database in a Docker CentOS environment.

Redis installation and master-slave configuration performed to "2.2.4 Start Redis Service" can be identified as the REDIS environment is completed. But it's not so easy to build these things in a Docker container. For example, in your container to have make, g++, AutoConfig and other environments, but think about it, these compilation needs of the environment in the real run when there is no o use. So we don't have to build this way today. We use the following methods:

1, on the Docker host, according to the Docker CentOS installation OpenSSH, build Docker centos SSH Environment

2, on the ordinary Linux server, follow the Redis installation and master-slave configuration to "2.2.4 Start Redis Service"

3. Copy the folder/usr/local/webserver/redis from the previous step to the Docker CentOS SSH environment, and do not assign permissions to the executable file.

4. Write Boot script

VI /run. SH #!/bin/bash/usr/local/webserver/redis/start. SH/usr/sbin/sshd-d


OK, it's so easy to finish.

Also want to share a problem I encountered, after creating a Redis container, the process of restarting the container on the host, if the Redis database is doing read and write tasks, the restarted container may not be able to start the Redis service. The specific error is as follows:

[Email protected] redis]#/usr/local/webserver/redis/redis-server/usr/local/webserver/redis/conf/redis.conf _._ _.-``__"'-._                                                   _.-``    `. `_."'-._ Redis2.6. -(00000000/0) -bit.-`` .-```. ```\/    _.,_"'-._                                    (    '      ,       .-`  | `,    ) Running in stand alone mode|`-._`-...-` __...-.``-._|'` _.-'| Port:6379| `-._   `._    /     _.-'    | Pid:42`-._    `-._  `-./  _.-'    _.-'|`-._`-._    `-.__.-'    _.-'_.-'| | `-._`-._        _.-'_.-'| http//Redis.io`-._    `-._`-.__.-'_.-'_.-'|`-._`-._    `-.__.-'    _.-'_.-'| | `-._`-._        _.-'_.-'|                                    `-._    `-._`-.__.-'_.-'_.-'`-._    `-.__.-'    _.-'                                                 `-._        _.-'`-.__.-'                                               [ the] -Jul -:Geneva:30.511# Server started, Redis version2.6. -[ the] -Jul -:Geneva:30.511# WARNING Overcommit_memory is set to0! Background save may fail under low memory condition. To fix this issue add'vm.overcommit_memory = 1'To/etc/sysctl.conf and ThenReboot or run the command'sysctl Vm.overcommit_memory=1'  forThis is take effect. [ the] -Jul -:Geneva:30.511# wrong signature trying to load DB fromfile[ the] -Jul -:Geneva:30.511#Fatal Error loading the Db:invalid argument. Exiting.

The reason for this analysis is that Redis is forced to stop when manipulating data files, resulting in incomplete data files and proper formatting.

Workaround:

Delete the *.rdb file under the/usr/local/webserver/redis/db/folder and restart the Redis container

Docker CentOS Installation Redis and problem handling

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.