In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how to install redis-3.0.5 from source code. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
# install redis-server #
# create and run users
Useradd redis-s / sbin/nologin-M
# upload the software to the specified location, and the location where my software is saved is
Mkdir-p / server/tools/
# decompress, configure, compile, install
Cd / server/tools/tar-zxf redis-3.0.5.tar.gz cd redis-3.0.5make PREFIX=/usr/local/redismake PREFIX=/usr/local/redis install
# configure redis environment variables
Echo'> > / etc/profileecho'> PATH for redis-server' > > / etc/profileecho 'export PATH=/usr/local/redis/bin/:$PATH' > > / etc/profile tail-3 / etc/profilesource / etc/profileecho $PATH
# or (restart fails)
Export PATH=/usr/local/redis/bin/:$PATHecho $PATH
# create configuration files, data, logs and other related directories, and copy configuration files
# creating a standard directory structure helps to form good habits and improve efficiency
Mkdir-p / usr/local/redis/confmkdir-p / usr/local/redis/datamkdir-p / usr/local/redis/logscp redis.conf / usr/local/redis/conf/cd / usr/local/redis/conf/tree / usr/local/redis
# at this point, the basic configuration of redis has been completed, and you can start using the initial configuration of redis
# start command
/ usr/local/redis/bin/redis-server / usr/local/redis/conf/redis.conf &
# View startup status, process and port
Ps-ef | grep redisnetstat-anptl | grep redis
# testing and use
# client connection command is:
/ usr/local/redis/bin/redis-cli-p 6379 [root@cache redis] # redis-cli-p 6379127.0.0.1 redis-cli 6379 > set a 1OK127.0.0.1:6379 > get a "1" 127.0.0.1 keys 6379 > set b 2OK127.0.0.1:6379 > set c 3OK127.0.0.1:6379 > keys * 1) "c" 2) "a" 3) "b" 127.0.0.1v 6379 > exit
# above are simple tests to verify whether the installation is correct or not
# safely disable redis
/ usr/local/redis/bin/redis-cli shutdown
# when redis is closed, the data will be saved as dump.rdb by default in the location where redis was started.
-simple optimization redis-
# when starting redis-server with default configuration, the following warning message appears: it does not affect the use of
# however, it is my custom that I will not tolerate the existence of such warnings:
[root@cache redis] # redis-server / usr/local/redis/conf/redis.conf & [1] 4570 [root@cache redis] # [4570] 07 Dec 03Mono 50.938 * Increased maximum number of open files to 10032 (it was originally set to 1024). _. _.-`. `_. '' -. _ Redis 3.0.5 (00000000Universe 0) 64 bit.-``.- ```. ```\ / _., _'-. _ (.-`|` ) Running in stand alone mode | `-. _` -.-`_ _...-.`` -. _ |'` _. -'| Port: 6379 | `-. _`. _ / _. -'| PID: 4570 `-. _` -. _ `-. _. -'| |` -. _ `-. _ _. -'_. -'| http://redis.io` -. _ `-. _. -'. | | `-. _` -. _ `. -'_. -'| |` -. _ `-. -'_. -'. _. -'`-. _`. -'. [4570] 07 Dec 03:54:50.939 # Server started Redis version 3.0.5 [4570] 07 Dec 03:54:50.939 # 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. [4570] 07 Dec 03 sysctl vm.overcommit_memory=1' for this to take effect 54 sysctl vm.overcommit_memory=1' for this to take effect 50.939 # 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. [4570] 07 Dec 03 The TCP backlog setting of 50.939 # WARNING: The TCP backlog setting of 511 cannot be enforced because / proc/sys/net/core/somaxconn is set to the lower value of 128.[ 4570] 07 Dec 03 The TCP backlog setting of 50.939 * The server is now ready to accept connections on port 6379
# optimize some kernel parameters according to the startup log prompt, and follow the prompts:
Echo never > / sys/kernel/mm/transparent_hugepage/enabledcat / sys/kernel/mm/transparent_hugepage/enabledecho 511 > / proc/sys/net/core/somaxconncat / proc/sys/net/core/somaxconnecho "vm.overcommit_memory = 1" > > / etc/sysctl.confsysctl-p
# the restart of the above operation fails. You can press the operation to configure the next boot to take effect, and by the way, set redis to boot automatically.
Echo "> > / etc/rc.localecho" # redis-server by zs in $(date +% F) "> > / etc/rc.localecho" echo never > / sys/kernel/mm/transparent_hugepage/enabled "> > / etc/rc.localecho" echo 511 > / proc/sys/net/core/somaxconn "> > / etc/rc.localecho" / usr/local/redis/bin/redis-server / usr/local/redis/conf/redis.conf "> > / etc/rc.localtail-5 / etc/rc.local
# continue to optimize configuration files
Vim / usr/local/redis/conf/redis.conf
# look for the following keywords in the configuration file, and you can modify them as follows:
Whether daemonize yes # is running in the background Yes saves pid files running pidfile / usr/local/redis/logs/redis.pid # redis in the background port 6379 # redis monitoring port bind 0.0.0.0 # IPtimeout 0 # client connection monitored by redis remains connected when the server closes Timeout # 0 means continuous connection Wait for the client to connect to logfile "/ usr/local/redis/logs/redis.log" # log file save location dbfilename redis.rdb # redis data file name dir / usr/local/redis/data/ # redis data storage location appendonly yes # whether to log, similar to mysql's bin-log
The above is a simple optimized configuration of redis
Thank you for reading! On "how to install redis-3.0.5 through the source code" this article is shared here, 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, you can share it out for more people to see it!
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.