]>
Commit | Line | Data |
---|---|---|
d3207647 | 1 | Where to find complete Redis documentation? |
2 | ------------------------------------------- | |
3 | ||
4 | This README is just a fast "quick start" document. You can find more detailed | |
3fb1c8a0 | 5 | documentation at http://redis.io |
d3207647 | 6 | |
7 | Building Redis | |
8 | -------------- | |
9 | ||
10 | It is as simple as: | |
11 | ||
12 | % make | |
13 | ||
d3207647 | 14 | You can run a 32 bit Redis binary using: |
15 | ||
16 | % make 32bit | |
17 | ||
3fb1c8a0 | 18 | After building Redis is a good idea to test it, using: |
d3207647 | 19 | |
20 | % make test | |
21 | ||
3fb1c8a0 JO |
22 | NOTE: if after building Redis with a 32 bit target you need to rebuild it |
23 | with a 64 bit target you need to perform a "make clean" in the root | |
24 | directory of the Redis distribution. | |
25 | ||
26 | Allocator | |
27 | --------- | |
28 | ||
a63a3d4d PN |
29 | Selecting a non-default memory allocator when building Redis is done by setting |
30 | the `MALLOC` environment variable. Redis is compiled and linked against libc | |
31 | malloc by default, with the exception of jemalloc being the default on Linux | |
32 | systems. This default was picked because jemalloc has proven to have fewer | |
33 | fragmentation problems than libc malloc. | |
3fb1c8a0 | 34 | |
a63a3d4d | 35 | To force compiling against libc malloc, use: |
3fb1c8a0 | 36 | |
a63a3d4d | 37 | % make MALLOC=libc |
3fb1c8a0 | 38 | |
a63a3d4d | 39 | To compile against jemalloc on Mac OS X systems, use: |
3fb1c8a0 | 40 | |
a63a3d4d | 41 | % make MALLOC=jemalloc |
3fb1c8a0 JO |
42 | |
43 | Verbose build | |
44 | ------------- | |
45 | ||
46 | Redis will build with a user friendly colorized output by default. | |
47 | If you want to see a more verbose output use the following: | |
48 | ||
ca1f766a | 49 | % make V=1 |
0a802bd7 | 50 | |
d3207647 | 51 | Running Redis |
52 | ------------- | |
53 | ||
54 | To run Redis with the default configuration just type: | |
55 | ||
56 | % cd src | |
57 | % ./redis-server | |
58 | ||
59 | If you want to provide your redis.conf, you have to run it using an additional | |
60 | parameter (the path of the configuration file): | |
61 | ||
62 | % cd src | |
63 | % ./redis-server /path/to/redis.conf | |
64 | ||
65 | Playing with Redis | |
66 | ------------------ | |
67 | ||
68 | You can use redis-cli to play with Redis. Start a redis-server instance, | |
69 | then in another terminal try the following: | |
70 | ||
71 | % cd src | |
72 | % ./redis-cli | |
73 | redis> ping | |
74 | PONG | |
75 | redis> set foo bar | |
76 | OK | |
77 | redis> get foo | |
78 | "bar" | |
79 | redis> incr mycounter | |
80 | (integer) 1 | |
81 | redis> incr mycounter | |
82 | (integer) 2 | |
83 | redis> | |
84 | ||
85 | You can find the list of all the available commands here: | |
86 | ||
e491a1a1 | 87 | http://redis.io/commands |
d3207647 | 88 | |
ca1f766a | 89 | Installing Redis |
90 | ----------------- | |
91 | ||
92 | In order to install Redis binaries into /usr/local/bin just use: | |
93 | ||
94 | % make install | |
95 | ||
96 | You can use "make PREFIX=/some/other/directory install" if you wish to use a | |
97 | different destination. | |
98 | ||
99 | Make install will just install binaries in your system, but will not configure | |
100 | init scripts and configuration files in the appropriate place. This is not | |
101 | needed if you want just to play a bit with Redis, but if you are installing | |
102 | it the proper way for a production system, we have a script doing this | |
103 | for Ubuntu and Debian systems: | |
104 | ||
105 | % cd utils | |
106 | % ./install_server | |
107 | ||
108 | The script will ask you a few questions and will setup everything you need | |
109 | to run Redis properly as a background daemon that will start again on | |
110 | system reboots. | |
111 | ||
112 | You'll be able to stop and start Redis using the script named | |
113 | /etc/init.d/redis_<portnumber>, for instance /etc/init.d/redis_6379. | |
114 | ||
d3207647 | 115 | Enjoy! |