Installation and configuration of Redis under Mac

Source: Internet
Author: User
Tags redis version

I. Installation of Redis

1, to the official website to download the latest Redis version number, I downloaded the 3.0.3

http://redis.io/

2. Copy redis-3.0.3 to/usr/local folder

3. Unzip sudo tar-zxf redis-3.0.3.tar.gz

4. Enter the uncompressed folder CD redis-3.0.3

5. Compile test: sudo make test


6. Compiling and Installing: sudo make install


7, start the service:./redis-server



(PS: This interface reminds me of the warrior line I played in 1999, a mud game) and there was a warning that there was no configuration file. We need to make a configuration of progress.

Second, the configuration

Configuration:

1. Create a Redis folder under/usr/local/. Create bin,etc,db three folders under the Redis folder

sudo mkdir/usr/local/redis/bin

....


2, the SRC folder under the Mkreleasehdr.sh,redis-benchmark, Redis-check-dump, Redis-cli. Redis-server Copy To

Bin folder

sudo mv/usr/local/redis3.0.3/mkreleasehdr.sh/usr/local/redis/mkreleasehdr.sh

......


3, in etc, the original redis3.0.3 folder under the redis.conf. Create a new redis.conf

Cd/usr/local/redis/etc

Vim redis.conf


Change redis.conf, details such as the following:


#改动为守护模式

Daemonize=yes

#设置进程锁文件

Pidfile/usr/local/redis/redis.pid

#port

Port 6379

#client超时时间

Timeout 300

#日志级别

LogLevel Debug

#日志文件位置

Logfile/usr/local/redis/log-redis.log

#设置数据库的数量. The default database is 0. Ability to specify the database ID on the connection using the Select <dbid> command

Databases 8

# #指定在多长时间内, the number of update operations to synchronize data to a data file. Ability to fit multiple conditions

#Save <seconds> <changes>

#Redis默认配置文件里提供了三个条件:

Save 900 1

Save 300 10

Save 60 10000

# Specifies whether the data is compressed when stored to a local database, and defaults to Yes. Redis adopts LZF compression, which is assumed to save CPU time.

#能够关闭该 # option, but will cause the database file to become huge

Rdbcompression Yes

#指定本地数据库文件名称

Dbfilename Dump.rdb

#指定本地数据库路径

dir/usr/local/redis/db/

#指定是否在每次更新操作后进行日志记录, Redis asynchronously writes data to disk by default. Assuming that it does not open, it may

#会在断电时导致一段时间内的数据丢失. Since the Redis itself synchronizes the data files synchronously according to the save conditions above, there are

#的数据会在一段时间内仅仅存在于内存中

AppendOnly No

#指定更新日志条件, together with 3 selectable values:

#No: Indicates that the data cache of the operating system is synchronized to disk (fast)

#always: Represents a manual call to Fsync () to write data to disk (slow, secure) after each update operation

#Everysec: Indicates synchronization once per second (tradeoff. Default value)

Appendfsync everysec


4, assume that the user is not root, then in order to reduce trouble. Ability to change all the folders to the person:


Chown-r xxxx Redis


5. After saving, start Redis


./bin/redis-server etc/redis.conf

6. Viewing log files

Tail-f Log-redis.log



At this point, Redis installation and configuration is complete! Be able to try it out.






Installation and configuration of Redis under Mac

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.