Install redis
Download and compile redis
We recommend that you compile the source code for installation. Before installing redis, make sure that the GCC and libc libraries are installed in the system. Download the redis source code. You can download the specified version of redis on redis. Io.
Wget http://Download. redis. IO/redis-stable.tar.gz
Tar xvzf redis-stable.tar.gz
CD redis-stable
Make
After compilation, the src directory under the redis directory stores the executable redisProgram, Where:
- Redis-ServerRedis Service System
- Redis-cliRedis Client Management Tool
- Redis-BenchmarkUsed to detect redis Performance
- Redis-check-AofAndRedis-check-dumpUsed to process corrupted data files
For convenience, you can copy redis-server and redis-CLI to the bin folder.
Sudo CP redis-server/usr/local/bin/
Sudo CP redis-cli/usr/local/bin/
Start redis Service
$ Redis-Server
[28550] 01 Aug 19:29:28 # warning: No config file specified, using the default config. In order to specify a Config File use 'redis-server/path/to/redis. conf'
[28550] 01 Aug 19:29:28 * server started, redis version 2.2.12
[28550] 01 Aug 19:29:28 * the server is now ready to accept connections on port 6379
... And so forth...
The preceding command starts a service without any configuration information. All configuration information uses the default reids configuration.
You can enable the configuration file settings by attaching the absolute path of the configuration file to the redis-server command, for example:
Redis-server/etc/redis. conf
By default, the redis configuration file is stored in the redis folder named redis. conf. You can copy this file as a configuration template to the root directory.
The default connection port of the redis server is 6379.
Use redis as a Linux service for random startup
VI/etc/rc. Local, use the VI editor to open the random STARTUP configuration file, and add the following line to itCode.
/Root/4 Setup/redis-2.4.7/Src/redis-Server
Client Connection Verification
You can use the redis-cli client program that comes with redis to link to the redis server. If Pong is returned, the service is successfully started.
$ Redis-cli Ping
Pong
You can also use another method without parameters.
$ Redis-cli
Redis127.0.0.1:6379> Ping
Pong
Stop a redis instance
The simplest way is to stop an instance directly using control-C in the session of the instance.
We can also use a client to stop the service. For example, we can use shutdown to stop redis instances, as shown below:
$ Src/redis-cli Shutdown
# Disable the redis-server on the specified port
$ Redis-cli-P 6380 Shutdown
Redis graphical interface management tool phpmyredis
Https://github.com/colummcgaley/phpMyRedis