1.安装Redis
1.下载、解压Redis
[wch@localhost Redis]$ lltotal 1248-rwxrwxr-x.1 wch wch 1276198Sep2023:31 redis-2.8.22.tar.gz[wch@localhost Redis]$ tar -zxvf redis-2.8.22.tar.gz
2.安装Redis
[wch@localhost Redis]$ lltotal 1252drwxrwxr-x.6 wch wch 4096Sep801:03 redis-2.8.22-rwxrwxr-x.1 wch wch 1276198Sep2023:31 redis-2.8.22.tar.gz[wch@localhost Redis]$ cd redis-2.8.22[wch@localhost redis-2.8.22]$ make PREFIX=/home/wch/InstallSoft/redis installcd src && make installmake[1]:Entering directory `/home/wch/SoftWare/Redis/redis-2.8.22/src'Hint: It's a good idea to run 'make test' ;)INSTALL installINSTALL installINSTALL installINSTALL installINSTALL installmake[1]: Leaving directory `/home/wch/SoftWare/Redis/redis-2.8.22/src'[wch@localhost redis-2.8.22]$
默认安装路径:/usr/local/bin,只需要使用命令:make install
指定安装路径:make PREFIX=/some/other/directory install,注意PREFIX大小写不能变!
2.启动Redis服务
1.启动服务端
进入安装路径,可以看到有一个bin目录,进入bin目录,启动Redis服务
[wch@localhost bin]$ lltotal 15208-rwxr-xr-x.1 wch wch 4574611Oct104:39 redis-benchmark-rwxr-xr-x.1 wch wch 22201Oct104:39 redis-check-aof-rwxr-xr-x.1 wch wch 45411Oct104:39 redis-check-dump-rwxr-xr-x.1 wch wch 4676357Oct104:39 redis-clilrwxrwxrwx.1 wch wch 12Oct104:39 redis-sentinel -> redis-server-rwxr-xr-x.1 wch wch 6242453Oct104:39 redis-server[wch@localhost bin]$ ./redis-server[13745]01Oct04:45:05.889# Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf[13745]01Oct04:45:05.890# You requested maxclients of 10000 requiring at least 10032 max file descriptors.[13745]01Oct04:45:05.890# Redis can't set maximum open files to 10032 because of OS error: Operation not permitted.[13745]01Oct04:45:05.890# Current maximum open files is 1024. maxclients has been reduced to 992 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'._.__.-``__ ''-.__.-```. `_.''-._ Redis2.8.22(00000000/0)64 bit.-``.-```. ```/ _.,_ ''-._(' , .-` | `, ) Running in stand alone mode|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379| `-._ `._ / _.-' | PID: 13745`-._ `-._ `-./ _.-' _.-'|`-._`-._ `-.__.-' _.-'_.-'|| `-._`-._ _.-'_.-' | http://redis.io`-._ `-._`-.__.-'_.-' _.-'|`-._`-._ `-.__.-' _.-'_.-'||`-._`-._ _.-'_.-'|`-._ `-._`-.__.-'_.-' _.-'`-._ `-.__.-' _.-'`-._ _.-'`-.__.-'[13745]01Oct04:45:05.900# Server started, Redis version 2.8.22[13745]01Oct04:45:05.900# 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.[13745]01Oct04:45:05.901# WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.[13745]01Oct04:45:05.901*The server is now ready to accept connections on port 6379
2.使用客户端连接Redis服务
[wch@localhost bin]$ ./redis-cli127.0.0.1:6379> pingPONG127.0.0.1:6379>set name wchOK127.0.0.1:6379> get name"wch"127.0.0.1:6379>
-------------------------------------------------------------------------------------------------------------------------------