1;拷贝redis.conf配置文件
redis6379.conf pidfile /var/run/redis6380.pid port 6380 redis6380.conf pidfile /var/run/redis6380.pid port 6380
2;启动redis同时加载配置文件
redis-server redis6379.conf & redis-server redis6380.conf &
3;php测试
<?php /** * redis测试 */ $redis = new Redis(); $redis->connect('127.0.0.1', 6379); $redis->set('devil', 'hello world!'); echo $redis->get('devil'); echo '<br />---------------------<br />'; $redis2 = new Redis(); $redis2->connect('127.0.0.1', 6380); $redis2->set('devil', 'gongfuxiang'); echo $redis2->get('devil'); echo '<br />---------------------<br />'; echo $redis->get('devil'); // 输出 hello world! --------------------- gongfuxiang --------------------- hello world! ?>
发表评论: