phpRedisAdmin is a simple web interface to manage Redis databases.
一 环境准备
1.环境支持
yum -y install php php-devel php-mbstring httpd
2.安装php相关扩展
下载软件:https://github.com/phpredis/phpredis/tree/2.1.3
cd phpredis-2.1.3
phpize
./configure --enable-redis
make && make install
ls /usr/lib64/php/modules/
curl.so fileinfo.so json.so mbstring.so phar.so redis.so zip.so
vim /etc/php.ini
---
extension_dir = "/usr/lib64/php/modules/"
---
二 添加php程序
unzip phpRedisAdmin-master.zip
mv phpRedisAdmin-master /var/www/html/redisadmin
cd /var/www/html/redisadmin
curl -s http://getcomposer.org/installer | php
php composer.phar create-project -s dev erik-dubbelboer/php-redis-admin path/to/install
git clone https://github.com/nrk/predis.git vendor
cd includes/
cp config.sample.inc.php config.inc.php
vim config.inc.php
---
$config = array(
'servers' => array(
array(
'name' => 'redis master', // Optional name.
'host' => '172.16.52.132',
'port' => 6379,
'auth' => 'system',
'filter' => '*',
),
array(
'name' => 'redis_slave_130', // Optional name.
'host' => '172.16.52.130',
'port' => 6379,
'auth' => 'system',
'filter' => '*',
),
array(
'name' => 'redis_slave_131', // Optional name.
'host' => '172.16.52.131',
'port' => 6379,
'auth' => 'system',
'filter' => '*',
)
---
NOTE:可添加多个redis server
unzip predis-1.0.zip
mv predis-1.0 /var/www/html/redisadmin/predis
chown -R apache.apache redisadmin/ #可省略
chmod -R 777 redisadmin/ #可省略
三 测试
访问:http://172.16.52.137/redisadmin
NOTE:phpredisadmin自动识别主从,只写主不写从。