In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "how to build and install Redis in centOS7 environment". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to build and install Redis in centOS7 environment" can help you solve the problem.
1. Upload the Redis package and decompress it with tar-zxvf command
2. In the decompressed package, execute the make command to compile
3. Execute the make install command; make install PREFIX=/usr/local/redis (there is no configure file after Redis is decompressed, so you can specify the installation directory at this step; only if the folder mkdir / usr/local/redis is added first)
4. Modify the configuration
> 1. Copy configuration files: in the installation directory, see the conf folder in the same level directory of bin. Use the cp command to copy the redis.conf files in the decompressed Redis directory to the new conf directory.
> 2. Modify the redis,conf file
a. Port:
Default port:6379
B.timeout:
Close the connection when the client has been idle for how long; if specified as 0, the function is turned off, that is, the connection is not closed
c. Start at the background:
Not launched in the background by default: daemonize no
Can be modified to start in the background (after entering the startup command, you can continue to operate in the current command window, otherwise, it will be blocked, that is, the terminal is occupied and can only open a new window to continue operation), that is, it can be configured as a daemon: daemonize yes
d. Snapshot name:
Default is dump.rdb. It is recommended that the port number be named prod.rdb. It is easy to distinguish between multiple instances: dbfilename dump.rdb.
Default is appendonly.aof. It is recommended that the port number be named prod.aof. It is easy to distinguish between multiple instances: appendfilename "appendonly.aof".
e. Snapshot file storage path:
Default is dir. /; that is, the directory where redis is started; specify the directory location of rdb/AOF files. Only folders can not be files.
f. Maximum number of connections:
The default is 10,000; the following 10000 is commented, but the default is also 10000
g. Maximum memory usage:
The default is the annotated # maxmemory; the maximum memory usage is not limited by default, that is, the physical memory of the server where the redis resides. Generally, some of it is reserved for the system, such as 20%, 30%.
H.bind:
You can bind the ip that is allowed to be accessed (bind is the IP that can be accessed by the binding native redis), as follows:
# bind 192.168.1.100 10.0.0.1
# bind 127.0.0.1:: 1
If you want to allow all hosts to access (local and remote (if it is a CVM, configure a private ip), annotate all bind
Default: bind 127.0.0.1, which means only local access is allowed
i. Protection mode:
Default is on: protected-mode yes
Turn off protected-mode mode, which can be directly accessed by external networks.
To enable protected-mode mode, you need to configure bind IP or set an access password. If you do not bind IP and set a password, you can only access it locally and do not allow other IP access.
j. Set the redis password:
Default is # requirepass foobared, which can be changed to 123456
k. Modify the profile name:
The name of the configuration file is changed to the port number to facilitate the distinction between multiple instances.
Mv redis.conf 6379.conf
5. Start redis
Launch:. / redis-server.. / conf/6379.conf & with the specified configuration file
6. Log in:
Connect to the client. / redis-cli, the default port number can be unspecified,-p port,-h host
After entering the client: command: auth 123456 (password you set)
7. Add environment variables:
Vim / etc/profile
# redis
Export REDIS_HOME=/usr/local/redis
Export PATH=$REDIS_HOME/bin:$PATH
Source / etc/profile
This is the end of the introduction on "how to build and install Redis in centOS7 environment". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
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.