redis安全策略 redis工具

 1 安全策略:

 设置数据库密码
修改配置requirepass password
验证密码auth password 只有验证通过后才能继续执行命令
注意:在配置redis复制功能的时候如果主数据库设置了密码,需要在从数据的配置文件中通过masterauth参数设置主数据库的密码,这样从数据库在连接主数据库时就会自动使用auth命令认证了。相当于做了一个免密码登录。
bind参数(可以让数据库只能在指定IP下访问)
bind 127.0.0.1 192.168.1.110 这样内网的1段都可以访问
命令重命名 不让错误执行flushall 清空所有数据
修改命令的名称rename-command flushall cleanall
禁用命令 rename-command flushall ""

2 工具:

redis-cli
Info查看使用信息等/monitor监视器 看用户做的每一个操作

eg:

[root@h2master bin]# redis-cli
127.0.0.1:6379> info
# Server
redis_version:2.8.19
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:4b1addfd5f9adb27
redis_mode:standalone
os:Linux 2.6.18-308.el5 i686
arch_bits:32
multiplexing_api:epoll
gcc_version:4.1.2
process_id:21558
run_id:86a4890d01e244f1e0e5ac557497f8fee82182a3
tcp_port:6379
uptime_in_seconds:151177
uptime_in_days:1
hz:10
lru_clock:16746810
config_file:/etc/redis.conf

# Clients
connected_clients:2
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0

# Memory
used_memory:735376
used_memory_human:718.14K
used_memory_rss:1859584
used_memory_peak:812744
used_memory_peak_human:793.70K
used_memory_lua:23552
mem_fragmentation_ratio:2.53
mem_allocator:jemalloc-3.6.0

# Persistence
loading:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1425974859
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:0
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:19
total_commands_processed:4090
instantaneous_ops_per_sec:0
total_net_input_bytes:139943
total_net_output_bytes:21378
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:1
evicted_keys:0
keyspace_hits:20
keyspace_misses:3
pubsub_channels:1
pubsub_patterns:0
latest_fork_usec:786

# 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.72
used_cpu_user:0.40
used_cpu_sys_children:0.02
used_cpu_user_children:0.01

# Keyspace
db0:keys=2004,expires=0,avg_ttl=0

 
Redisclient
http://www.oschina.net/news/53391/redisclient-1-0

Redisclient 截图如下:



 

猜你喜欢

转载自chengjianxiaoxue.iteye.com/blog/2191146