当前位置 : 主页 > 网络编程 > 其它编程 >

Redis学习第一篇

来源:互联网 收集:自由互联 发布时间:2023-07-02
1、安装过程中,需要修改参数[root@localhost~]#vietcsysctl.conf[root@localhost~]#sysctlvm.overcommit_ 1、安装过程中,需要修改参数 [root@localhost ~]# vi /etc/sysctl.conf[root@localhost ~]# sysctl vm.overcommit_memory=
1、安装过程中,需要修改参数[root@localhost~]#vietcsysctl.conf[root@localhost~]#sysctlvm.overcommit_

1、安装过程中,需要修改参数

[root@localhost ~]# vi /etc/sysctl.conf[root@localhost ~]# sysctl vm.overcommit_memory=1

2、执行以下命令之后,没有在后台执行,一直会挂在那,这和Oracle、mysql不一样。

[root@localhost src]# ./redis-server [6622] 18 Jul 15:45:04.150 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf[6622] 18 Jul 15:45:04.151 * Increased maximum number of open files to 10032 (it was originally set to 1024)._._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 2.8.17 (00000000/0) 64 bit.-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in stand alone mode|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379| `-._ `._ / _.-' | PID: 6622`-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-'[6622] 18 Jul 15:45:04.160 # Server started, Redis version 2.8.17[6622] 18 Jul 15:45:04.160 # 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.[6622] 18 Jul 15:45:04.160 * The server is now ready to accept connections on port 6379^C[6622 | signal handler] (1563435987) Received SIGINT scheduling shutdown...[6622] 18 Jul 15:46:27.200 # User requested shutdown...[6622] 18 Jul 15:46:27.200 * Saving the final RDB snapshot before exiting.

3、使用set name 只会保存最后一次set的数据,这应该是这个库中只有一个表,这个表只有一行。

127.0.0.1:6379> set name "dayu"OK127.0.0.1:6379> set name "dayu2"OK127.0.0.1:6379> set name "dayu3"OK127.0.0.1:6379> get name"dayu3"127.0.0.1:6379>

4、用户默认进的是db 0,redis默认一共有16个,每个库中应该是只能存放一种数据类型。

127.0.0.1:6379[3]> SET runoobkey redisOK127.0.0.1:6379[3]> get runoobkey"redis"127.0.0.1:6379[3]> select 4OK127.0.0.1:6379[4]> get runoobkey(nil)127.0.0.1:6379[4]> select 16(error) ERR invalid DB index127.0.0.1:6379> select 15OK127.0.0.1:6379[15]> get runoobkey(nil)127.0.0.1:6379[15]> select 0OK127.0.0.1:6379> get runoobkey(nil)127.0.0.1:6379> select 0OK127.0.0.1:6379> get runoobkey(nil)

上一篇:吸塑包装的四种分类
下一篇:没有了
网友评论