In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Yum install-y wget gcc make tcl
Wget http://download.redis.io/releases/redis-3.0.2.tar.gz
Tar zxvf redis-3.0.2.tar.gz
Make
Make test
If an error is reported:
!!! WARNING The following tests failed:
* * [err]: Test replication partial resync: ok psync (diskless: yes, reconnect: 1) in tests/integration/replication-psync.tcl
Expected condition'[s-1 sync_partial_ok] > 0'to be true ([s-1 sync_partial_ok] > 0)
Change the tests/integration/replication-psync.tcl file:
Vi tests/integration/replication-psync.tcl
Change the number after the after in the code corresponding to the error report from 100 to 500. Personally, this parameter seems to be the number of milliseconds to wait.
Make install
Cp redis.conf / etc/
Touch / etc/init.d/redis
Chmod 755 / etc/init.d/redis
-vi / etc/init.d/redis-
#! / bin/bash
#
# Init file for redis
#
# chkconfig:-80 12
# description: redis daemon
#
# processname: redis
# config: / etc/redis.conf
# pidfile: / var/run/redis.pid
Source / etc/init.d/functions
# BIN= "/ usr/local/bin"
BIN= "/ usr/local/bin"
CONFIG= "/ etc/redis.conf"
PIDFILE= "/ var/run/redis.pid"
# Read configuration
[- r "$SYSCONFIG"] & & source "$SYSCONFIG"
RETVAL=0
Prog= "redis-server"
Desc= "Redis Server"
Start () {
If [- e $PIDFILE]; then
Echo "$desc already running...."
Exit 1
Fi
Echo-n $"Starting $desc:"
Daemon $BIN/$prog $CONFIG
RETVAL=$?
Echo
[$RETVAL-eq 0] & & touch / var/lock/subsys/$prog
Return $RETVAL
}
Stop () {
Echo-n $"Stop $desc:"
Killproc $prog
RETVAL=$?
Echo
[$RETVAL-eq 0] & & rm-f / var/lock/subsys/$prog $PIDFILE
Return $RETVAL
}
Restart () {
Stop
Start
}
Case "$1" in
Start)
Start
Stop)
Stop
Restart)
Restart
Condrestart)
[- e / var/lock/subsys/$prog] & & restart
RETVAL=$?
Status)
Status $prog
RETVAL=$?
*)
Echo $"Usage: $0 {start | stop | restart | condrestart | status}"
RETVAL=1
Esac
Exit $RETVAL
-vi / etc/redis.conf-
Daemonize yes
-
As a high-speed memory key-value pair (Key-Value) database, Redis is widely used. If it is a remote connection, security must be taken into account. So how do you set up security for Redis?
Redis password management
one。 How to initialize the password for redis?
A total of 2 steps:
a. There is a parameter in the configuration file: requirepass this is the parameter to configure the redis access password.
Like requirepass test123.
b. Restart redis is required for the parameters in the configuration file to take effect. Vi / etc/redis.conf
two。 How do I configure a password without restarting redis?
a. Configure the password for requirepass in the configuration file (the password is still valid when redis is restarted).
# requirepass foobared
If it is modified to:
Requirepass test123
b. Enter redis to redefine parameters
View the current password:
[root@slaver251 redis-2.4.16] #. / src/redis-cli-p 6379
Redis 127.0.0.1 6379 > # p# paging title # e #
Redis 127.0.0.1 6379 > config get requirepass View password
1) "requirepass"
2) (nil)
Show that the password is empty
Then set the password:
Redis 127.0.0.1 6379 > config set requirepass test123
OK
Query the password again:
Redis 127.0.0.1 6379 > config get requirepass
(error) ERR operation not permitted
I made a mistake at this time!
Now all you need is password authentication.
Redis 127.0.0.1 6379 > auth test123
OK
Query the password again:
Redis 127.0.0.1 6379 > config get requirepass
1) "requirepass"
2) "test123"
The password has been changed.
When it is time to restart redis, the password will automatically take effect because the configuration parameters have been changed.
If the configuration parameter does not add a password, then the redis restart password will be equivalent to no setting.
three。 How do I log in to redis with a password?
a. Enter the password when you log in.
[root@slaver251 redis-2.4.16] #. / src/redis-cli-p 6379-a test123
Redis 127.0.0.1 6379 > # p# paging title # e #
Redis 127.0.0.1 6379 > config get requirepass
1) "requirepass"
2) "test123"
b. Log in before you verify:
[root@slaver251 redis-2.4.16] #. / src/redis-cli-p 6379
Redis 127.0.0.1 purl 6379 >
Redis 127.0.0.1 6379 > auth test123
OK
Redis 127.0.0.1 6379 > config get requirepass
1) "requirepass"
2) "test123"
Redis 127.0.0.1 purl 6379 >
four。 Master has a password, how to configure slave?
When master has a password to configure slave, the corresponding password parameters must also be configured accordingly. Otherwise, slave will not be able to copy normally.
The corresponding parameters are:
# masterauth
For example:
Masterauth mstpassword
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.