Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of individual Mode installation and configuration in Redis 5.05

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the Redis 5.05 individual mode installation and configuration example analysis, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Operating system Centos7

1. Download redis

Wget http://download.redis.io/releases/redis-5.0.5.tar.gztar xzf redis-5.0.5.tar.gzcd redis-5.0.5make

2. Start the service

After the command execution is complete, you can start the Redis service

[root@zk02 redis] # src/redis-server 5265:C 23 Oct 2019 16:58:04.682 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo5265:C 23 Oct 2019 16:58:04.682 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=5265, just started5265:C 23 Oct 2019 16:58:04.682 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server / path/to/redis.conf5265:M 23 Oct 2019 16 Oct 58 Increased maximum number of open files to 10032 (it was originally set to 1024). _. _.-`. `_. '' -. _ Redis 5.0.5 (00000000Universe 0) 64 bit.-``.- ```. ```\ / _., _'-. _ (.-`|` ) Running in standalone mode | `-. _`...-.`` -. _ |'`_. -'| Port: 6379 |` -. _ `. _ / _. -'| PID: 5265` -. _ `-. _`. / _. -'_. -'| `-. _ _. -'| |` -. _ `. _. -'_. -'| http://redis.io `-. _. -'. |` -. _ `-.--'_. -'|` -. _ `-. -'_. -'|` -. `-. _` -'_. -'_. -'`-. _ _.-'5265Oct M 23 Oct 2019 16V 58 Oct 04.684 # WARNING: The TCP backlog setting of 511 cannot be enforced because / proc/sys/net/core/somaxconn is set to the lower value of 128.5265cannot be enforced because M 23 Oct 2019 16VZ 5884 # Server initialized5265:M 23 Oct 2019 16RV 58R 04.684 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory=1' to / etc/sysctl.conf and then reboot or run the command' sysctl vm.overcommit_memory=1' for this to take effect.5265:M 23 Oct 2019 16V 58 sysctl vm.overcommit_memory=1' for this to take effect.5265:M 04.684 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > / sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your / etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.5265:M 23 Oct 2019 16 Ready to accept connections 58 Switzerland 04.684 * Ready to accept connections

3. Interact with redis through the built-in client

[root@zk02 redis] # src/redis-cli 127.0.0.1 set foo bar OK127.0.0.1:6379 > get foo "bar" 127.0.0.1

The number of open files for the log can be set with the following command

Ulimit-n 10032

Ps: let's take a look at the Redis 5.0.5 single-node installation configuration

download

Http://download.redis.io/releases/redis-5.0.5.tar.gz

Decompression

Tar-C / usr/local-xvf redis-5.0.5.tar.gz

Compilation and installation

Cd / usr/local/redis-5.0.5make install

Install using make install, the default installation directory is / usr/local/bin/

Redis profile

Copy the sample configuration file to / etc/redis/639.conf

Mkdir / etc/rediscp / usr/local/redis-5.0.5/redis.conf / etc/redis/6379.conf

Turn off protection mode

Protected-mode no

Open access to other hosts and comment out bind 127.0.0.1

Bind 127.0.0.1

Change to background startup

Daemonize yes

For logging, you need to create a directory / var/applogs/redis first.

Logfile "/ var/applogs/redis/redis.log"

Data storage directory

Mkdir-p / var/redis-data/dir / var/redis-data

Set password

Requirepass xxxx

Redis configuration Boot Boot Service

Use the startup script that comes with Redis

Cp / root/share/deploy-ready/redis-5.0.5/utils/redis_init_script / etc/init.d/redisd

Configure to enable self-startup

Chkconfig redisd on

Set Boot self-boot

Chkconfig redisd on

Firewall development port 6379

Firewall-cmd-permanent-add-port=6379/tcpfirewall-cmd-reload

Client connection Redis

Redis-cli-h 192.168.43.197-p 6379-a xxxx Thank you for reading this article carefully. I hope the article "sample Analysis of individual Mode installation and configuration in Redis 5.05" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report