得鹿梦鱼 得鹿梦鱼

数据备份与恢复

BGSAVE
SAVE

安全

config get requirepass
config set requirepass password
auth password

性能测试

redis-benchmark

客户端连接

config get maxclients

PHP 使用 Redis

安装

wget https://github.com/phpredis/phpredis/archive/3.1.4.tar.gztar -zxvf phpredis-3.1.4.tar.gzcd phpredis-3.1.4    ./configure --with-php-config=/usr/local/php/bin/php-configmake && make installvi php.iniextension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20090626"extension=redis.soservice apache restart
$redis = new Redis;$redis->connect'127.0.0.1', 6379;echo "Connection to server successfully";echo "Server is running: " . $redis->ping;$redis->set"tutorial-name", "Redis tutorial"echo "Stored string in redis:: " . $redis->get"tutorial-name"\$redis->lpush"tutorial-list", "Redis";$redis->lpush"tutorial-list", "Mongodb";$redis->lpush"tutorial-list", "Mysql";$arList = $redis->lrange"tutorial-list", 0 ,5var_dump$arList