LessonFifth Redis的持久化功能
#验证redis的快照和AOF功能
1.先验证RDB快照功能,由于AOF优先级高,先关闭,然后测试,截图如下
2.设置打开AOF 然后进行实验,截图如下:
作业第二题:
#把文本文件中的内容读入到redis中去,用适当的数据结构存储
require 'rubygems'
require 'redis'
#使用hashset 来存储用户的pwd email信息
#格式 uid pwd
# uid email
redis = Redis.new
f = File.open('/home/student/data/lessonfifthdata.txt')
f.each_line do |l|
items = l.split('#')
for i in (0..2) do
redis.hset(items[0],'pwd',items[1])
redis.hset(items[0],'email',items[2])
end
end
f.close()
Looking for a job working at Home about MSBI