CMS、phpmyadmin、phpRedisadminR等设定
phpmyadmin
phpmyadmin开启登录地址(管理其他数据库)
下载安装好phpmyadmin后,默认是管理本地数据库的。要管理其他数据库就要开启地址框选项。
打开.../phpmyadmin/libraries 目录;修改config.default.php 文件找到“AllowArbitraryServer”
$cfg['AllowArbitraryServer'] = false;
#修改成:
$cfg['AllowArbitraryServer'] = true;
保存退出,刷新后就能看到地址框了,记得要在远程数据库中授权登录。
phpredmin的安装
法一:真机安装
phpredmin是phpredisadmin的美化版本,漂亮的界面。直观的数据统计。
phpinfo.php查看你的proc_open有没有被禁用,如果禁用了是无法使用make test
命令的;
会报错:
The Process class relies on proc_open, which is not available on your PHP installation.
# 或
+-----------------------------------------------------------+
| ! ERROR ! |
| The test-suite requires that proc_open() is available. |
| Please check if you disabled it in php.ini. |
+-----------------------------------------------------------+
编辑PHP配置文件(配置文件可能有多个,找到真正使用的那个),搜索:disable_functions,看到proc_open函数,删掉保存退出;安装完后可以再次关闭proc_open;这是比较危险的可以执行系统命令的函数。
先find / -name igbinary.h
,如果找不到文件,说明没有安装igbinary,按Installing的方法安装好。
安装依赖phpredis
git clone https://github.com/phpredis/phpredis.git
cd phpredis
phpize
./configure --enable-redis-igbinary
make && make test
make install
最后安装phpredmin
git clone https://github.com/sasanrose/phpredmin.git
# apache就按照README的方法配置conf;如果是nginx的话用看issues#62:https://github.com/sasanrose/phpredmin/issues/62
# 如果是一机多站(vhost)方式,这种配置比较麻烦,我没有实验成功。
# phpredmin的配置,参考Docker部分,直接修改配置文件,保存刷新就能看到效果。
法二:Docker方式
原命令:docker run -p 8080:80 -d --name phpredmin -e "PHPREDMIN_DATABASE_REDIS_0_HOST=192.168.1.6" -e "PHPREDMIN_AUTH_USERNAME=root" sasanrose/phpredmin
# 我使用的
docker run -p 9999:80 -d --name phpredmin sasanrose/phpredmin
docker exec -it [CONTAINER ID] /bin/bash
apt install -y lrzsz vim
vim ../config.dist.php
**注意:**默认是管理localhost的redis;可以拷贝array段进行修改,括号不要少了,如下:
<?php
$config = array(
'default_controller' => 'Welcome',
'default_action' => 'Index',
'production' => true,
'default_layout' => 'layout',
'timezone' => 'Europe/Amsterdam',
'auth' => array(
'username' => 'admin',
'password' => password_hash('admin', PASSWORD_DEFAULT)
),
'log' => array(
'driver' => 'file',
'threshold' => 1, /* 0: Disable Logging 1: Error 2: Notice 3: Info 4: Warning 5: Debug */
'file' => array(
'directory' => 'logs'
)
),
'database' => array(
'driver' => 'redis',
'mysql' => array(
'host' => 'localhost',
'username' => 'root',
'password' => 'root'
),
'redis' => array(
array(
'host' => '192.168.12.120',
'port' => '6379',
'password' => null,
'database' => 0,
'max_databases' => 16, /* Manual configuration of max databases for Redis < 2.6 */
'stats' => array(
'enable' => 1,
'database' => 0,
),
'dbNames' => array( /* Name databases. key should be database id and value is the name */
),
),
array(
'host' => '192.168.12.121',
'port' => '6379',
'password' => null,
'database' => 0,
'max_databases' => 16, /* Manual configuration of max databases for Redis < 2.6 */
'stats' => array(
'enable' => 1,
'database' => 0,
),
'dbNames' => array( /* Name databases. key should be database id and value is the name */
),
),
array(
'host' => '192.168.12.109',
'port' => '6379',
'password' => null,
'database' => 0,
'max_databases' => 16, /* Manual configuration of max databases for Redis < 2.6 */
'stats' => array(
'enable' => 1,
'database' => 0,
),
'dbNames' => array( /* Name databases. key should be database id and value is the name */
),
),
array(
'host' => '172.16.20.75',
'port' => '6379',
'password' => null,
'database' => 0,
'max_databases' => 16, /* Manual configuration of max databases for Redis < 2.6 */
'stats' => array(
'enable' => 1,
'database' => 0,
),
'dbNames' => array( /* Name databases. key should be database id and value is the name */
),
),
array(
'host' => '172.16.20.76',
'port' => '6379',
'password' => null,
'database' => 0,
'max_databases' => 16, /* Manual configuration of max databases for Redis < 2.6 */
'stats' => array(
'enable' => 1,
'database' => 0,
),
'dbNames' => array( /* Name databases. key should be database id and value is the name */
),
),
),
'session' => array(
'lifetime' => 7200,
'gc_probability' => 2,
'name' => 'phpredminsession'
),
'gearman' => array(
'host' => '127.0.0.1',
'port' => 4730
),
'terminal' => array(
'enable' => true,
'history' => 200
),
),
);
return $config;
保存退出,重启容器,没问题就可以生成新镜像了。
docker restart [CONTAINER ID] #不要stop再start的方式重启,这会导致所做的配置全部失效。变回初始镜像。
docker commit [CONTAINER ID] [new_images_name]
打包好新镜像后运行要加制定变量,不然redis服务器列表会出现重复,注意0-4数字,按顺序增加,配置文件里有多少项,这里就能配置多少项,多了少了都会出现重复(可能是个bug)
docker run -p 9999:80 -d --name phpredmin \
-e "PHPREDMIN_DATABASE_REDIS_0_HOST=192.168.12.109" \
-e "PHPREDMIN_DATABASE_REDIS_1_HOST=192.168.12.120" \
-e "PHPREDMIN_DATABASE_REDIS_2_HOST=192.168.12.121" \
-e "PHPREDMIN_DATABASE_REDIS_3_HOST=172.16.20.75" \
-e "PHPREDMIN_DATABASE_REDIS_4_HOST=172.16.20.76" \
qw_phpredmin02
版权声明:
本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自
LeoLan的小站!
喜欢就支持一下吧