正常的
wget http://download.redis.io/releases/redis-3.0.7.tar.gz下载
解压缩
tar -zxvf redis-3.0.7.tar.gz
cd redis-3.0.7
这全很正常没有什么可以说的,主要是下面,进入到redis-3.0.7目录之后,要是执行
make
make install 会把redis默认安装到/usr/local/bin/redis下
但是我只是一个普通的redis用户,我不想给他sudo权限也不想用root去执行怎么办呢
方法是:
bash-4.1$ PREFIX=/opt/redis make
bash-4.1$ PREFIX=/opt/redis make install
cd src && make install
make[]: Entering directory `/opt/redis/redis-3.0./src' Hint: It's a good idea to run 'make test' ;) INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install
make[]: Leaving directory `/opt/redis/redis-3.0./src'
bash-4.1$ pwd
/opt/redis/redis-3.0.
bash-4.1$ cd ..
bash-4.1$ ls -all
total
drwxr-xr-x redis redis May : .
drwxr-xr-x root root May : ..
drwxr-xr-x redis redis May : bin
drwxr-xr-x redis redis Jan : redis-3.0.
-rw-r--r-- redis redis May : redis-3.0..tar.gz
drwx------ redis redis May : .ssh
指定到你想要安装的目录下就可以了,大功告成
接下来设置主备和哨兵
Master(主)配置文件
vi /opt/redis//.conf port
daemonize yes
appendonly yes
save ""
slave-read-only yes
自己在redis目录下建立一个6000的文件夹
Salve(从)配置文件
vi /opt/redis//.conf port
daemonize yes
slaveof 10.171.132.17 ----主的地址和端口,一看就明白
appendonly yes
save ""
slave-read-only yes
配置sentinel 1
vi /opt/redis//sentinel-.conf port
daemonize yes
sentinel monitor mymaster 10.171.132.17 --主的地址
sentinel down-after-milliseconds mymaster
sentinel failover-timeout mymaster
sentinel config-epoch mymaster
sentinel leader-epoch mymaster
配置sentinel 2
vi /opt/redis//sentinel-.conf port
daemonize yes
sentinel monitor mymaster 10.171.132.17
sentinel down-after-milliseconds mymaster
sentinel failover-timeout mymaster
sentinel config-epoch mymaster
sentinel leader-epoch mymaster
然后再启动下:
./redis-server --include /opt/redis//.conf
./redis-server --include /opt/redis//.conf ./redis-sentinel /opt/redis//sentinel-.conf
./redis-sentinel /opt/redis//sentinel-.conf
这样子redis就安装配置好了~而且是用最普通的用户实现的,保证了系统权限的划分。