In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail what matters needing attention in the process of using Docker, the editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
External storage mount of Redis
Persistence is enabled: both RDB and AOF mode will need to be stored on the hard disk. Take RDB as an example, a file called dump.rdb will automatically exist on your local hard disk. If no external storage is mounted, the data will disappear after docker destruction.
The demand for hard disk of Replication under master-slave setting: before Redis 2.8, the synchronization of Master and Slave needs storage (hard disk) as the intermediary (since 2.8this synchronization can not go through the hard disk, but still belongs to the experimental content). In the Docker environment, you need to mount the Volume to ensure that this step works properly.
Redis can't run in daemonize mode.
The Docker container requires the main process to be running at the front end all the time, and using daemonize mode will cause container to exit immediately after running. Fortunately, daemonize mode is turned off by default in Redis's configuration file. If you want to run daemon mode, you should use the-d command at the docker level.
The log file directory for Redis should be set to empty
The logs generated by Docker's containers will be automatically received and managed by the system; at the same time, Caicloud's cluster management platform will monitor and aggregate the logs of all containers in the system. So setting logfile to null in the configuration file will enjoy the automatic log collection and management of Docker and Caicloud.
Considerations for Redis Snapshot
Snapshot should be enabled under the master-slave structure: if Persistenceoff is configured on the Master node of the Redis (data is not automatically stored on the hard disk), then we should also turn off the automatic restart function of the Master node. Since the auto-repair feature of Caicloud will restart effective containers (including RedisMaster), we should enable the Snapshot feature.
Requirements for Persistence: Redis will write the rdb files generated by Snapshot in the specified directory. By default, this corresponds to a directory inside the Docker, which is destroyed when the Docker is destroyed. If there is a need for Persistence, external storage should be mounted at the same time as the Dockerfile is generated and the Redis container is run.
Port Mapping of Redis
Docker's container maps the application port in the container to a random host port by default at run time, but this breaks some Redis services. For example, sentinel needs to automatically discover according to the default port rule (26379). Therefore, when running Redis under Docker, be sure to use the format of-p port:port to explicitly use the default Redis port rules.
Discovery of Master nodes in Redis Master-Slave structure
In the master-slave structure, the slave node (slave) needs to use the IP of the Master node in the configuration file to realize the interconnection with the Master node. In traditional architecture, this IP can be pre-bound through static binding. In the Caicloud system, the system does not need to bind the specific IP address statically, but can find it dynamically through DNS, and use a specific script to dynamically add Master IP to the configuration by running the CMD command when Docker.
Coexistence of multiple Redis clusters
Under Caicloud, there will be no mixing of two Redis Cluster (https://www.oschina.net/news/67037/container-redis-accident)) because of the unique network characteristics of Caicloud (flattening, each machine has its own network segment). As mentioned in the example, the mixing of two Redis clusters requires the following conditions:
Running server instances (from cluster An and cluster B) from two Redis clusters on one physical machine
There are two server instances (from cluster An and cluster B) in two Redis clusters that happen to have the same IP (possible in a pure Docker environment because the Docker on each host randomly assigns network segments and IP)
In a Caicloud environment, each Redis server is assigned a different IP, and the IP of each two Redis server must be different (each machine has its own network segment, so the Docker on different machines does not crash when assigning an address to the container).
This is the end of this article on "what matters needing attention in the process of using Docker". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.