redis基礎知識

redis

windows下redis安裝 http://www。runoob。com/redis/redis-install。html進入redis目錄啟動 redis-server。exe redis。windows。conf登入 redis-cli。exe -h 127。0。0。1 -p 6379 redis-cli -a s12344Redis 設定密碼登入 修改redis。windows。conf#requirepass foobared。設定密碼的方法就是去掉註釋的#,把foobared替換成自己的密碼即可,例如將密碼設定為123456服務自啟動redis-server ——service-install redis。windows。conf ——loglevel verbose 問題 Invalid argument during startup: unknown conf file parameter : requirepassredis 設定來密碼,出現來這個錯誤,把配置檔案那一行的空格去掉# requirepass foobared改成requirepass 123456啟動redis。/redis/src/redis-server 。/redis/redis。conf &關閉redis。/redis/src/redis-cli -h host -p port -a password shutdownhost值在。/redis/redis。conf檔案中搜索bindport值在。/redis/redis。conf檔案中搜索portpassword值在/redis/redis。conf檔案中搜索requirepass進入redis命令列。/redis/src/redis-cli -h host -p port -a password

[root@localhost src]# cd /opt/stech/custom/redis-2。8。17/[root@localhost redis-2。8。17]# redis-server redis。conf //啟動redis [root@localhost ~]# redis-cli //進入redis客戶端127。0。0。1:6379> keys * //取出所有的key (empty list or set)127。0。0。1:6379> quit //退出客戶端 127。0。0。1:6379> set key1 value1 //setOK127。0。0。1:6379> get key1 //get“value1”127。0。0。1:6379> del k1 //刪除一個key(integer) 1127。0。0。1:6379> flushdb //清空所有資料Exception in thread “main” redis。clients。jedis。exceptions。JedisDataException: DENIED Redis is running in protected mode because protected mode is enabled。。。。進入客戶端設定模式:redis-cliconfig set protected-mode “no”