redis linux

[root@winkey ~]# ll /zwf/redis
total 21816
-rw-r--r-- 1 root root    7742 Mar 24 15:16 Makefile
-rw-r--r-- 1 root root 4589099 Mar 24 15:16 redis-benchmark
-rw-r--r-- 1 root root   22169 Mar 24 15:16 redis-check-aof
-rw-r--r-- 1 root root   45387 Mar 24 15:16 redis-check-dump
-rw-r--r-- 1 root root 4692174 Mar 24 15:16 redis-cli
-rw-r--r-- 1 root root   42348 Mar 24 15:18 redis.conf
-rw-r--r-- 1 root root 6459759 Mar 24 15:16 redis-sentinel
-rw-r--r-- 1 root root 6459759 Mar 24 15:17 redis-server
[root@winkey ~]# chmod +x /zwf/redis/redis-server
[root@winkey ~]# chmod +x /zwf/redis/redis-benchmark
[root@winkey ~]# chmod +x /zwf/redis/redis-check-aof
[root@winkey ~]# chmod +x /zwf/redis/redis-check-dump
[root@winkey ~]# chmod +x /zwf/redis/redis-cli
[root@winkey ~]# chmod +x /zwf/redis/redis-sentinel
[root@winkey ~]# ll /zwf/redis
total 21816
-rw-r--r-- 1 root root    7742 Mar 24 15:16 Makefile
-rwxr-xr-x 1 root root 4589099 Mar 24 15:16 redis-benchmark
-rwxr-xr-x 1 root root   22169 Mar 24 15:16 redis-check-aof
-rwxr-xr-x 1 root root   45387 Mar 24 15:16 redis-check-dump
-rwxr-xr-x 1 root root 4692174 Mar 24 15:16 redis-cli
-rw-r--r-- 1 root root   42348 Mar 24 15:18 redis.conf
-rwxr-xr-x 1 root root 6459759 Mar 24 15:16 redis-sentinel
-rwxr-xr-x 1 root root 6459759 Mar 24 15:17 redis-server

[root@winkey ~]# /zwf/redis/redis-server /zwf/redis/redis.conf
10693:C 24 Mar 15:21:01.156 # Can't chdir to './zwf/redis': No such file or directory
[root@winkey ~]# cd /zwf/redis
[root@winkey redis]# redis-server redis.conf
2192:C 24 Mar 15:35:29.526 # Can't chdir to './zwf/redis': No such file or directory
[root@winkey ~]# cd /
[root@winkey /]# /zwf/redis/redis-server /zwf/redis/redis.conf
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.3 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6380
 |    `-._   `._    /     _.-'    |     PID: 10694
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

10694:M 24 Mar 15:22:34.196 # Server started, Redis version 3.0.3
10694:M 24 Mar 15:22:34.196 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
10694:M 24 Mar 15:22:34.196 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
10694:M 24 Mar 15:22:34.196 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
10694:M 24 Mar 15:22:34.196 * The server is now ready to accept connections on port 6380

[root@winkey /]# /zwf/redis/redis-cli -h 119.23.33.56 -p 6380
119.23.33.56:6380> select 7
OK
119.23.33.56:6380[7]> set zengwenfeng zengwenfeng
OK
119.23.33.56:6380[7]> get zengwenfeng
"zengwenfeng"
119.23.33.56:6380[7]> exit
[root@winkey /]# 


[root@winkey /]# /zwf/redis/redis-cli -p 6380 monitor
OK

^H1490341055.497153 [0 110.87.92.248:50362] "PING"
1490341055.519985 [0 110.87.92.248:50362] "INFO"
1490341055.554574 [0 110.87.92.248:50362] "select" "8"
1490341055.586482 [8 110.87.92.248:50362] "select" "9"
1490341055.618343 [9 110.87.92.248:50362] "select" "10"
1490341055.636761 [10 110.87.92.248:50362] "select" "11"
1490341055.654184 [11 110.87.92.248:50362] "select" "12"
1490341055.685279 [12 110.87.92.248:50362] "select" "13"
1490341055.703268 [13 110.87.92.248:50362] "select" "14"
1490341055.720748 [14 110.87.92.248:50362] "select" "15"
1490341055.737773 [15 110.87.92.248:50362] "select" "16"
1490341056.494884 [15 110.87.92.248:50362] "SELECT" "0"
1490341056.550117 [0 110.87.92.248:50362] "scan" "0" "MATCH" "*" "COUNT" "10000"
1490341056.678867 [0 110.87.92.248:50362] "scan" "0" "MATCH" "*" "COUNT" "10000"
1490341060.102354 [0 110.87.92.248:50362] "scan" "0" "MATCH" "*" "COUNT" "10000"
1490341080.491115 [0 110.87.92.248:50362] "SELECT" "7"
1490341080.551713 [7 110.87.92.248:50362] "scan" "0" "MATCH" "*" "COUNT" "10000"






package redis_01; import java.util.ArrayList; import java.util.List; import redis.clients.jedis.JedisPoolConfig; import redis.clients.jedis.JedisShardInfo; import redis.clients.jedis.ShardedJedis; import redis.clients.jedis.ShardedJedisPool; public class TestRedis { /** * 随笔风~ 随风~ * * @author ZengWeFeng * @date 2015.03.12 * @param args */ public static void main(String[] args) { List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>(); shards.add(new JedisShardInfo("192.168.3.15", 6379)); shards.add(new JedisShardInfo("192.168.3.2", 6379)); ShardedJedisPool sjp = new ShardedJedisPool(new JedisPoolConfig(), shards); ShardedJedis client = sjp.getResource(); try { client.set("AA", "123"); client.set("BB", "234"); client.set("CC", "345"); client.set("DD", "345"); try { System.out.println(client.get("AA")); System.out.println(client.get("BB")); System.out.println(client.get("CC")); System.out.println(client.get("DD")); } catch (Exception e) { e.printStackTrace(); } } catch (Exception e) { e.printStackTrace(); } finally { sjp.returnResource(client); } } } 


http://www.cnblogs.com/fengru/p/5793087.html


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

spencer_tseng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值