#yum -y install gcc
#cd /usr/local/src
#tar -zxvf redis-3.0.5.tar.gz
#cd redis-3.05/
#make PREFIX=/usr/local/redis install 将redis安装在/usr/local/redis目录下
#cp /usr/local/src/redis-3.0.5/utils/redis_init_script /etc/init.d/redis(redis启动脚本)
#cp /usr/local/src/redis-3.0.5/redis.conf /etc/redis.conf
#cd /usr/local/redis
启动redis:
[root@ELK2 redis]# ./bin/redis-server &
[1] 7226
[root@ELK2 redis]# 7226:C 13 Apr 02:06:13.822 # Warning: no config file specified, using the default config. In order to specify a config file use ./bin/redis-server /path/to/redis.conf
7226:M 13 Apr 02:06:13.824 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.0.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 7226
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
7226:M 13 Apr 02:06:13.826 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
7226:M 13 Apr 02:06:13.826 # Server started, Redis version 3.0.7
7226:M 13 Apr 02:06:13.826 # 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.
7226:M 13 Apr 02:06:13.826 # 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.
7226:M 13 Apr 02:06:13.826 * DB loaded from disk: 0.000 seconds
7226:M 13 Apr 02:06:13.826 * The server is now ready to accept connections on port 6379
[root@ELK2 redis]# bin/redis-cli
127.0.0.1:6379>
使用redis-cli --raw进入redis即可显示中文
[root@ELK2 redis]# bin/redis-cli --raw
127.0.0.1:6379> set raw "中文显示"
OK
127.0.0.1:6379> get raw
中文显示
查看远程Redis服务器的版本:bin/redis-cli -h 192.168.1.111 info
[root@ELK2 redis]# bin/redis-cli info
# Server
redis_version:3.0.7
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:60b2a2de75226b64
redis_mode:standalone
os:Linux 2.6.32-573.22.1.el6.x86_64 x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.4.7
process_id:7226
run_id:1f65f36242c9d3e5cdbd43e968074d5afb02ca3e
tcp_port:6379
uptime_in_seconds:6
uptime_in_days:0
hz:10
lru_clock:866587
config_file:
# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
# Memory
used_memory:815912
used_memory_human:796.79K
used_memory_rss:7983104
used_memory_peak:815912
used_memory_peak_human:796.79K
used_memory_lua:36864
mem_fragmentation_ratio:9.78
mem_allocator:jemalloc-3.6.0
# Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1460484373
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_last_write_status:ok
# Stats
total_connections_received:1
total_commands_processed:0
instantaneous_ops_per_sec:0
total_net_input_bytes:14
total_net_output_bytes:0
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
evicted_keys:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
latest_fork_usec:0
migrate_cached_sockets:0
# Replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
# CPU
used_cpu_sys:0.01
used_cpu_user:0.01
used_cpu_sys_children:0.00
used_cpu_user_children:0.00
# Cluster
cluster_enabled:0
# Keyspace