In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "redis single-node case analysis", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "redis single-node case analysis"!
1. Install jdk1.8
[root@sht-sgmhadoopdn-04 ~] # cd / usr/java/
[root@sht-sgmhadoopdn-04 java] # wget-no-check-certificate-no-cookies-header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz
[root@sht-sgmhadoopdn-04 java] # tar-zxvf jdk-8u111-linux-x64.tar.gz
[root@sht-sgmhadoopdn-04 java] # vi / etc/profile
Export JAVA_HOME=/usr/java/jdk1.8.0_111
Export path=$JAVA_HOME/bin:$PATH
[root@sht-sgmhadoopdn-04 java] # source / etc/profile
[root@sht-sgmhadoopdn-04 java] # java-version
Java version "1.8.0,111"
Java (TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot (TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
[root@sht-sgmhadoopdn-04 java] #
two。 Install redis 3.2.5
2.1 install the required package gcc,tcl
[root@sht-sgmhadoopdn-04 local] # yum install gcc
[root@sht-sgmhadoopdn-04 local] # yum install tcl
2.2 download redis-3.2.5
[root@sht-sgmhadoopdn-04 local] # wget http://download.redis.io/releases/redis-3.2.5.tar.gz
-- 2016-11-12 20-12-20-14-14-11-12-11-12-11-12-20-16-14-12-11-12-20-16-40-http://download.redis.io/releases/redis-3.2.5.tar.gz
Resolving download.redis.io (download.redis.io)... 109.74.203.151
Connecting to download.redis.io (download.redis.io) | 109.74.203.151 |: 80. Connected.
HTTP request sent, awaiting response... 200 OK
Length: 1544040 (1.5m) [application/x-gzip]
Saving to: 'redis-3.2.5.tar.gz'
1544040 221KB/s in 6.8s
2016-11-12 20:16:47 (221 KB/s)-'redis-3.2.5.tar.gz' saved [1544040Universe 1544040]
2.3 install redis
[root@sht-sgmhadoopdn-04 local] # mkdir / usr/local/redis
[root@sht-sgmhadoopdn-04 local] # tar xzvf redis-3.2.5.tar.gz
[root@sht-sgmhadoopdn-04 local] # cd redis-3.2.5
[root@sht-sgmhadoopdn-04 redis-3.2.5] # make PREFIX=/usr/local/redis install
[root@sht-sgmhadoopdn-04 redis-3.2.5] # cd.. /
[root@sht-sgmhadoopdn-04 redis-3.2.5] # ll / usr/local/redis/bin/
Total 15056
-rwxr-xr-x 1 root root 2431728 Nov 12 20:45 redis-benchmark
-rwxr-xr-x 1 root root 25165 Nov 12 20:45 redis-check-aof
-rwxr-xr-x 1 root root 5182191 Nov 12 20:45 redis-check-rdb
-rwxr-xr-x 1 root root 2584443 Nov 12 20:45 redis-cli
Lrwxrwxrwx 1 root root 12 Nov 12 20:45 redis-sentinel-> redis-server
-rwxr-xr-x 1 root root 5182191 Nov 12 20:45 redis-server
2.4 configure redis as a service
[root@server redis-3.2.5] # cp utils/redis_init_script / etc/rc.d/init.d/redis
[root@server redis-3.2.5] # vi / etc/rc.d/init.d/redis
Add: # chkconfig: 2345 80 90 on the second line
Modify EXEC=/usr/local/bin/redis-server to EXEC=/usr/local/redis/bin/redis-server
Modify CLIEXEC=/usr/local/bin/redis-cli to CLIEXEC=/usr/local/redis/bin/redis-cli
CONF= "/ etc/redis/$ {REDISPORT} .conf" modified to CONF= "/ usr/local/redis/conf/$ {REDISPORT} .conf"
Change $EXEC $CONF to $EXEC $CONF &
[root@server redis-3.2.5] # mkdir / usr/local/redis/conf/
[root@server redis-3.2.5] # chkconfig-- add redis
[root@server redis-3.2.5] # cp redis.conf / usr/local/redis/conf/6379.conf
[root@server redis-3.2.5] # vi / usr/local/redis/conf/6379.conf
Daemonize yes
Pidfile / var/run/redis_6379.pid
Bind 172.16.101.66
2.5 start redis
[root@server redis-3.2.5] # cd.. / redis
[root@sht-sgmhadoopdn-04 redis] # service redis start
Starting Redis server...
[root@sht-sgmhadoopdn-04 redis] # netstat-tnlp | grep redis
Tcp 00 172.16.100.79 6379 0.0.0.0 * LISTEN 30032/redis-server
[root@sht-sgmhadoopdn-04 redis] #
2.6 add environment variables
[root@sht-sgmhadoopdn-04 redis] # vi / etc/profile
Export REDIS_HOME=/usr/local/redis
Export PATH=$REDIS_HOME/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@sht-sgmhadoopdn-04 redis] # source / etc/profile
[root@sht-sgmhadoopdn-04 redis] # which redis-cli
/ usr/local/redis/bin/redis-cli
2.7 Test and set password (no password is set in this lab)
[root@sht-sgmhadoopdn-04 redis] # redis-cli-h sht-sgmhadoopdn-04
Sht-sgmhadoopdn-04:6379 >
Sht-sgmhadoopdn-04:6379 > set testkey testvalue
OK
Sht-sgmhadoopdn-04:6379 > get test
(nil)
Sht-sgmhadoopdn-04:6379 > get testkey
"testvalue"
Sht-sgmhadoopdn-04:6379 >
[root@sht-sgmhadoopdn-04 redis] # vi / usr/local/redis/conf/6379.conf
/ * add an authentication password * /
Requirepass 123456
[root@sht-sgmhadoopdn-04 redis] # service redis stop
[root@sht-sgmhadoopdn-04 redis] # service redis start
[root@sht-sgmhadoopdn-04 redis] # redis-cli-h sht-sgmhadoopdn-04
Sht-sgmhadoopdn-04:6379 > set key ss
(error) NOAUTH Authentication required.
[root@server redis-3.2.5] # redis-cli-h sht-sgmhadoopdn-04-a 123456
Sht-sgmhadoopdn-04:6379 > set a b
OK
Sht-sgmhadoopdn-04:6379 > get a
"b"
Sht-sgmhadoopdn-04:6379 > exit
[root@sht-sgmhadoopdn-04 redis] #
Thank you for reading, the above is the content of "redis single-node instance analysis". After the study of this article, I believe you have a deeper understanding of the problem of redis single-node instance analysis, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.