wget http://download.redis.io/releases/redis-2.8.13.tar.gz
CD redis-2.8.13
Make Prefix=/usr/local/redis Install
CP redis.conf/usr/local/redis/
[Email protected] bin]# cd/usr/local/redis/
[[email protected] redis]# ls
Bin Redis.conf
[Email protected] redis]# CD bin/
[Email protected] bin]# nohup./redis-server &
[Email protected] bin]# Ps-ef | grep Redis
[Email protected] bin]# vim/usr/local/redis/redis.conf
[Email protected] bin]# vim/usr/local/redis/redis.conf #我们可以采用开启后台启动redis命令; Change to Yes
[[email protected] bin]# pkill Redis #先杀死redis进程, start again
[Email protected] bin]#/usr/local/redis/bin/redis-server/usr/local/redis/redis.conf #我们可以发现redis监听的默认端口6379
We enter the Redis library directly on the Redis side, and Redis defaults to 16 databases, via select [number] into the corresponding database
We can view the configuration information of Redis by means of help Config
127.0.0.1:6379> CONFIG GET * #获取redis服务器所有配置信息
127.0.0.1:6379> CONFIG SET loglevel "notice" #获取redis服务器日志级别
127.0.0.1:6379> CONFIG GET Bind #获取redis监听的端口
1) "Bind"
2) ""
127.0.0.1:6379> CONFIG GET daemonize #配置文件的后台启动
1) "Daemonize"
2) "Yes"
127.0.0.1:6379> CONFIG SET requirepass "Xiaoyupass" #我们通过key设置redis一个密码
Ok
127.0.0.1:6379> KEYS * #我们再次查看, error (because no input secret)
(Error) Noauth Authentication required.
127.0.0.1:6379> AUTH Xiaoyupass #输入密码 to view
Ok
127.0.0.1:6379> KEYS *
1) "Xiaoyu"
2) "Website"
127.0.0.1:6379>
[Email protected] ~]#/usr/local/redis/bin/redis-cli-a xiaoyupass #在外部进行密码验证
########## #将LAP与redis整合
In general, the web and Redis integration need to be developed ports to connect, because we previously built a Discuiz forum on the lap, there is this port,
[Email protected] ~]# vim/usr/local/httpd/htdocs/config/config_global.php
Add the Phpredis extension driver to connect the
[[Email protected] ~] #wget https://github.com/phpredis/phpredis/archive/3.1.2.tar.gz
[Email protected] ~]# tar zxf 3.1.2.tar.gz
[[email protected] ~]#/usr/local/php/bin/phize #因为没有 Configure file, cannot compile, so need to initialize
Need to install autoconf software
[email protected] phpredis-3.1.2]# Yum install autoconf-y
[Email protected] phpredis-3.1.2]#/usr/local/php/bin/phpize #再次初始化
[Email protected] ~]# tar zxf 3.1.2.tar.gz
[Email protected] ~]#/usr/local/php/bin/phize
[Email protected] phpredis-3.1.2]#/configure-with-php-config=/usr/local/php/bin/php-config--enable-redis
[[email protected] phpredis-3.1.2]# make
[[email protected] phpredis-3.1.2]# make test
[[email protected] phpredis-3.1.2]# make install
[Email protected] ~]# Cp/usr/src/php-5.3.28/php.ini-development/usr/local/php/lib/php.ini
[Email protected] ~]# Vim/usr/local/php/php.ini
[Email protected] ~]#/usr/local/httpd/bin/apachectl restart
[Email protected] ~]# vim/usr/local/httpd/htdocs/phpinfo.php
This situation indicates that Redis is connected to the drive of the lap!
[Email protected] ~]#/usr/local/redis/bin/redis-cli-a Xiaoyupass
lap+mysql-Master-Slave +redis