Install redis3
Posted xiaobin-hlj80
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Install redis3相关的知识,希望对你有一定的参考价值。
How To Install Redis in Ubuntu
What is Redis?
Redis is a flexible, open-source, key value data store. Following in the footsteps of other NoSQL databases, such as Cassandra, CouchDB, and MongoDB, Redis allows the user to store vast amounts of data without the limits of a relational database. Additionally, it has also been compared to memcache and can be used, with its basic elements as a cache with persistence.
Set-up Environment For Installation.
Before installing redis, there are a couple of prerequisites that need to be downloaded in-order to proceed with the installation.
1. Update all of the apt-get packages.
1
|
sudo apt-get update
|
2. Download a compiler with build essential in-order to install Redis from source.
1
|
sudo apt-get install build-essential
|
3. Download and install tcl8.5
1
|
sudo apt-get install tcl8.5
|
Install Redis
After all of the prerequisites and dependencies downloaded to the server, you can proceed with the Redis installation from source.
1. Download the Stable Redis release from their website. google code. The latest stable version is 2.8.3
1
|
wget http://download.redis.io/releases/redis-2.8.3.tar.gz
|
2. Extract the downloaded .tar file, and switch into that directory.
1
|
tar -xvzf redis-2.8.3.tar.gz && cd redis-2.8.3
|
3. Proceed to with the make command.
1
|
make
|
4. Run the recommended make test .
1
|
make test
|
5. Do the make install , which installs the program system-wide.
1
|
sudo make install
|
6. Once the program has been installed, Redis comes with a built in script that sets up Redis to run as a background daemon. To access the script move into the utils directory.
1
|
cd utils
|
7. From there, run the Ubuntu/Debian install script.
1
|
sudo ./install_server.sh
|
8. As the script runs, you can choose the default options by pressing enter. Once the script completes, the redis-server will be running in the background. You can start and stop redis with these commands (the number depends on the port you set during the installation. 6379 is the default port setting).
1
2
|
sudo service redis_6379 start
sudo service redis_6379 stop
|
install:(3.2)
[email protected]:~$ sudo apt-get update [email protected]-AQ5HJNE:~$ sudo apt-get install build-essential [email protected]-AQ5HJNE:~$ sudo apt-get install tcl [email protected]-AQ5HJNE:~$ wget http://download.redis.io/releases/redis-3.2.11.tar.gz [email protected]:~$ tar zxvf redis-3.2.11.tar.gz [email protected]-AQ5HJNE:~$ cd redis-3.2.11 [email protected]-AQ5HJNE:~/redis-3.2.11$ make [email protected]-AQ5HJNE:~/redis-3.2.11$ sudo make install [email protected]-AQ5HJNE:~/redis-3.2.11$ cd utils [email protected]-AQ5HJNE:~/redis-3.2.11/utils$ sudo ./install_server.sh Welcome to the redis service installer This script will help you easily set up a running redis server Please select the redis port for this instance: [6379] Selecting default: 6379 Please select the redis config file name [/etc/redis/6379.conf] Selected default - /etc/redis/6379.conf Please select the redis log file name [/var/log/redis_6379.log] Selected default - /var/log/redis_6379.log Please select the data directory for this instance [/var/lib/redis/6379] Selected default - /var/lib/redis/6379 Please select the redis executable path [/usr/local/bin/redis-server] Selected config: Port : 6379 Config file : /etc/redis/6379.conf Log file : /var/log/redis_6379.log Data dir : /var/lib/redis/6379 Executable : /usr/local/bin/redis-server Cli Executable : /usr/local/bin/redis-cli Is this ok? Then press ENTER to go on or Ctrl-C to abort. Copied /tmp/6379.conf => /etc/init.d/redis_6379 Installing service... Success! Starting Redis server... Installation successful!
test:
[email protected]:~/redis-3.2.11/utils$ sudo service redis_6379 start [email protected]-AQ5HJNE:~/redis-3.2.11/utils$ redis-cli 127.0.0.1:6379> ping PONG 127.0.0.1:6379> set key1 hello world (error) ERR syntax error 127.0.0.1:6379> set key1 [hello world] (error) ERR syntax error 127.0.0.1:6379> set key1 "hello world" OK 127.0.0.1:6379> get key1 "hello world" 127.0.0.1:6379> exit
以上是关于Install redis3的主要内容,如果未能解决你的问题,请参考以下文章
环境初始化 Build and Install the Apache Thrift IDL Compiler Install the Platform Development Tools(代码片段
Redis的make,make test,make install单机多实例配置,以及API程序写数据!
httpd Server not started: (13)Permission denied: make_sock: could not bind to address [::]:8888(代码片段