In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "the process of building redis". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Redis official website: http://download.redis.io/releases
Redis installation package redis-3.2.13.tar.gz
Decompress: tar-xvf redis-3.2.13.tar.gz
Put the unzipped redis under the directory you prepared, and I put it under the root.
Cd redis-3.2.13 make
Once compiled, go to the src file
[root@localhost src] # make install Hint: It's a good idea to run 'make test';) INSTALL install INSTALL install INSTALL install INSTALL install INSTALL install [root@localhost src] #
Return to the upper floor
[root@localhost redis-3.2.13] # pwd
/ redis-3.2.13
[root@localhost redis-3.2.13] # vim redis.conf
Bind 0.0.0.0 if someone wants to access it and change it to 0.0.0.0, the default is local connection.
Daemonize yes is not started in the background by default. We changed it to yes.
Remove # from requirepass 123and change the password. Restart takes effect.
Timeout 10
Now to start redis, we have set the background startup, so what will not be displayed:
[root@localhost redis-3.2.13] #. / src/redis-server / redis-3.2.13/redis.conf
View the process:
[root@localhost redis-3.2.13] # ps-ef | grep redis root 4434 10 10:54? 00:00:00. / src/redis-server 127.0.1 ef 6379 root 4506 818 0 10:55 pts/2 00:00:00 grep-- color=auto redis
Enter redis:
[root@localhost redis-3.2.13] # redis-cli-a 123 127.0.1 config get dir 6379 > 127.0.0.1 config get dir 1) "dir" 2) "/ redis-3.2.13" 127.0.0.1 config get dir 6379 >
The following can be done or not, which is convenient for later maintenance:
Enter the redis installation directory:
[root@localhost ~] # cd / redis-3.2.13/utils/ [root@localhost utils] # ll total 52-rw-rw-r--. 1 root root 593 Mar 19 00:25 build-static-symbols.tcl-rw-rw-r--. 1 root root 1303 Mar 19 00:25 cluster_fail_time.tcl-rw-rw-r--. 1 root root 1070 Mar 19 00:25 corrupt_rdb.c drwxrwxr-x. 2 root root 60 Mar 19 00:25 create-cluster-rwxrwxr-x. 1 root root 2137 Mar 19 00:25 generate-command-help.rb drwxrwxr-x. 2 root root 39 Mar 19 00:25 hashtable drwxrwxr-x. 2 root root 70 Mar 19 00:25 hyperloglog-rwxrwxr-x. 1 root root 8529 Mar 19 00:25 install_server.sh drwxrwxr-x. 2 root root 39 Mar 19 00:25 lru-rw-rw-r--. 1 root root 1277 Mar 19 00:25 redis-copy.rb-rwxrwxr-x. 1 root root 1098 Mar 19 00:25 redis_init_script-rwxrwxr-x. 1 root root 1047 Mar 19 00:25 redis_init_script.tpl-rw-rw-r--. 1 root root 1762 Mar 19 00:25 redis-sha1.rb drwxrwxr-x. 2 root root 114Mar 19 00:25 releasetools-rwxrwxr-x. 1 root root 3787 Mar 19 00:25 speed-regression.tcl-rwxrwxr-x. 1 root root 693 Mar 19 00:25 whatisdoing.sh [root@localhost utils] # vim redis_init_script REDISPORT=6379 EXEC=/usr/local/bin/redis-server-- find redis-server, mine at / redis-3.2.13/src CLIEXEC=/usr/local/bin/redis-cli-- find redis-server Mine is in / redis-3.2.13/src PIDFILE=/var/run/redis_$ {REDISPORT} .pid CONF= "/ etc/redis/$ {REDISPORT} .conf"-the configuration file is under the installation directory / redis-3.2.13, note the redis.confg name case "$1" in start) if [- f $PIDFILE] then echo "$PIDFILE exists, process is already running or crashed" else echo "Starting Redis server..." $EXEC $CONF fi ; stop) if [!-f $PIDFILE] then echo "$PIDFILE does not exist, process is not running" else PID=$ (cat $PIDFILE) echo "Stopping." $CLIEXEC-p $REDISPORT shutdown-pay attention to the password-a password while [- x / proc/$ {PID}] do echo "Waiting for Redis to shutdown." Sleep 1 done echo "Redis stopped" fi;; *) echo "Please use start or stop as first argument";; esac
Once modified, rename the file / etc/init.d to redis.
[root@localhost utils] # mv redis_init_script / etc/init.d/redis [root@localhost utils] # chmod + x / etc/init.d/redis
After the correction, stop and report an error, and find that it has not been configured yet:
[root@localhost utils] # service redis stop Stopping... (error) NOAUTH Authentication required. Waiting for Redis to shutdown... Waiting for Redis to shutdown... Waiting for Redis to shutdown... Waiting for Redis to shutdown... Waiting for Redis to shutdown... Waiting for Redis to shutdown... Waiting for Redis to shutdown... Waiting for Redis to shutdown... Waiting for Redis to shutdown... Waiting for Redis to shutdown...
Found the problem, it turns out that the script under / etc/init.d/redis is missing-a password authentication
[root@localhost init.d] # service redis stop Stopping... Redis stopped
Configure the following kernel parameters, otherwise the Redis script will report an error when restarting or stopping redis and will not automatically synchronize data to disk / etc/sysctl.conf before stopping service
# vim / etc/sysctl.conf
Vm.overcommit_memory = 1
# sysctl-p
Vi / etc/profile
The location of export PATH= "$PATH:/redis-3.2.13/src" is the location of redis-server and redis-cli.
Redis status Monitoring:
[root@localhost init.d] # redis-cli-a 123-stat
[root@localhost init.d] # redis-cli-a 123-- bigkeys-I 0.01
Scan large key
Master-slave synchronization:
1. Modify the configuration file of the slave library first.
Slaveof main library ip port
2, restart the slave library
3. Log in to the slave database, slaveof master library ip port-enable master-slave synchronization
The problems encountered.
1. Slaveof has been added from the library configuration file, but is not synchronized from the master. Check info.
Repl_backlog_active:0 displays 0
Solution: restart the slave library, execute slaveof no one, and then execute the slaveof master ip+ port
Redis uses the command:
127.0.0.1 config get dir 6379 > 1) "dir" 2) "/ apps/redis/data/master" 127.0.0.1 apps/redis/data/master 6379 >
Info views the basic information of redis
1 、 protected-mode
# protected-mode yes # whether to enable protection mode is enabled by default. If the bind and password are not specified in the configuration. When this parameter is enabled, redis will only access it locally and deny external access. If the password and bind are enabled, you can open it. Otherwise, it is best to turn it off and set it to no.
This is the end of the content of "the process of building redis". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.