Back to home page

Redis cross reference

 
 

    


0001 Where to find complete Redis documentation?
0002 -------------------------------------------
0003 
0004 This README is just a fast "quick start" document. You can find more detailed
0005 documentation at http://redis.io
0006 
0007 Building Redis
0008 --------------
0009 
0010 Redis can be compiled and used on Linux, OSX, OpenBSD, NetBSD, FreeBSD.
0011 We support big endian and little endian architectures.
0012 
0013 It may compile on Solaris derived systems (for instance SmartOS) but our
0014 support for this platform is "best effort" and Redis is not guaranteed to
0015 work as well as in Linux, OSX, and *BSD there.
0016 
0017 It is as simple as:
0018 
0019     % make
0020 
0021 You can run a 32 bit Redis binary using:
0022 
0023     % make 32bit
0024 
0025 After building Redis is a good idea to test it, using:
0026 
0027     % make test
0028 
0029 NOTE: if after building Redis with a 32 bit target you need to rebuild it
0030       with a 64 bit target you need to perform a "make clean" in the root
0031       directory of the Redis distribution.
0032 
0033 Allocator
0034 ---------
0035 
0036 Selecting a non-default memory allocator when building Redis is done by setting
0037 the `MALLOC` environment variable. Redis is compiled and linked against libc
0038 malloc by default, with the exception of jemalloc being the default on Linux
0039 systems. This default was picked because jemalloc has proven to have fewer
0040 fragmentation problems than libc malloc.
0041 
0042 To force compiling against libc malloc, use:
0043 
0044     % make MALLOC=libc
0045 
0046 To compile against jemalloc on Mac OS X systems, use:
0047 
0048     % make MALLOC=jemalloc
0049 
0050 Verbose build
0051 -------------
0052 
0053 Redis will build with a user friendly colorized output by default.
0054 If you want to see a more verbose output use the following:
0055 
0056     % make V=1
0057 
0058 Running Redis
0059 -------------
0060 
0061 To run Redis with the default configuration just type:
0062 
0063     % cd src
0064     % ./redis-server
0065     
0066 If you want to provide your redis.conf, you have to run it using an additional
0067 parameter (the path of the configuration file):
0068 
0069     % cd src
0070     % ./redis-server /path/to/redis.conf
0071 
0072 It is possible to alter the Redis configuration passing parameters directly
0073 as options using the command line. Examples:
0074 
0075     % ./redis-server --port 9999 --slaveof 127.0.0.1 6379
0076     % ./redis-server /etc/redis/6379.conf --loglevel debug
0077 
0078 All the options in redis.conf are also supported as options using the command
0079 line, with exactly the same name.
0080 
0081 Playing with Redis
0082 ------------------
0083 
0084 You can use redis-cli to play with Redis. Start a redis-server instance,
0085 then in another terminal try the following:
0086 
0087     % cd src
0088     % ./redis-cli
0089     redis> ping
0090     PONG
0091     redis> set foo bar
0092     OK
0093     redis> get foo
0094     "bar"
0095     redis> incr mycounter
0096     (integer) 1
0097     redis> incr mycounter
0098     (integer) 2
0099     redis> 
0100 
0101 You can find the list of all the available commands here:
0102 
0103     http://redis.io/commands
0104 
0105 Installing Redis
0106 -----------------
0107 
0108 In order to install Redis binaries into /usr/local/bin just use:
0109 
0110     % make install
0111 
0112 You can use "make PREFIX=/some/other/directory install" if you wish to use a
0113 different destination.
0114 
0115 Make install will just install binaries in your system, but will not configure
0116 init scripts and configuration files in the appropriate place. This is not
0117 needed if you want just to play a bit with Redis, but if you are installing
0118 it the proper way for a production system, we have a script doing this
0119 for Ubuntu and Debian systems:
0120 
0121     % cd utils
0122     % ./install_server
0123 
0124 The script will ask you a few questions and will setup everything you need
0125 to run Redis properly as a background daemon that will start again on
0126 system reboots.
0127 
0128 You'll be able to stop and start Redis using the script named
0129 /etc/init.d/redis_<portnumber>, for instance /etc/init.d/redis_6379.
0130 
0131 Code contributions
0132 ---
0133 
0134 Note: by contributing code to the Redis project in any form, including sending
0135 a pull request via Github, a code fragment or patch via private email or
0136 public discussion groups, you agree to release your code under the terms
0137 of the BSD license that you can find in the COPYING file included in the Redis
0138 source distribution.
0139 
0140 Please see the CONTRIBUTING file in this source distribution for more
0141 information.
0142 
0143 Enjoy!