2
0

README 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. Where to find complete Redis documentation?
  2. -------------------------------------------
  3. This README is just a fast "quick start" document. You can find more detailed
  4. documentation at http://redis.io
  5. Building Redis
  6. --------------
  7. Redis can be compiled and used on Linux, OSX, OpenBSD, NetBSD, FreeBSD.
  8. We support big endian and little endian architectures.
  9. It may compile on Solaris derived systems (for instance SmartOS) but our
  10. support for this platform is "best effort" and Redis is not guaranteed to
  11. work as well as in Linux, OSX, and *BSD there.
  12. It is as simple as:
  13. % make
  14. You can run a 32 bit Redis binary using:
  15. % make 32bit
  16. After building Redis is a good idea to test it, using:
  17. % make test
  18. Fixing problems building 32 bit binaries
  19. ---------
  20. If after building Redis with a 32 bit target you need to rebuild it
  21. with a 64 bit target, or the other way around, you need to perform a
  22. "make distclean" in the root directory of the Redis distribution.
  23. In case of build errors when trying to build a 32 bit binary of Redis, try
  24. the following steps:
  25. * Install the packages libc6-dev-i386 (also try g++-multilib).
  26. * Try using the following command line instead of "make 32bit":
  27. make CFLAGS="-m32 -march=native" LDFLAGS="-m32"
  28. Allocator
  29. ---------
  30. Selecting a non-default memory allocator when building Redis is done by setting
  31. the `MALLOC` environment variable. Redis is compiled and linked against libc
  32. malloc by default, with the exception of jemalloc being the default on Linux
  33. systems. This default was picked because jemalloc has proven to have fewer
  34. fragmentation problems than libc malloc.
  35. To force compiling against libc malloc, use:
  36. % make MALLOC=libc
  37. To compile against jemalloc on Mac OS X systems, use:
  38. % make MALLOC=jemalloc
  39. Verbose build
  40. -------------
  41. Redis will build with a user friendly colorized output by default.
  42. If you want to see a more verbose output use the following:
  43. % make V=1
  44. Running Redis
  45. -------------
  46. To run Redis with the default configuration just type:
  47. % cd src
  48. % ./redis-server
  49. If you want to provide your redis.conf, you have to run it using an additional
  50. parameter (the path of the configuration file):
  51. % cd src
  52. % ./redis-server /path/to/redis.conf
  53. It is possible to alter the Redis configuration passing parameters directly
  54. as options using the command line. Examples:
  55. % ./redis-server --port 9999 --slaveof 127.0.0.1 6379
  56. % ./redis-server /etc/redis/6379.conf --loglevel debug
  57. All the options in redis.conf are also supported as options using the command
  58. line, with exactly the same name.
  59. Playing with Redis
  60. ------------------
  61. You can use redis-cli to play with Redis. Start a redis-server instance,
  62. then in another terminal try the following:
  63. % cd src
  64. % ./redis-cli
  65. redis> ping
  66. PONG
  67. redis> set foo bar
  68. OK
  69. redis> get foo
  70. "bar"
  71. redis> incr mycounter
  72. (integer) 1
  73. redis> incr mycounter
  74. (integer) 2
  75. redis>
  76. You can find the list of all the available commands here:
  77. http://redis.io/commands
  78. Installing Redis
  79. -----------------
  80. In order to install Redis binaries into /usr/local/bin just use:
  81. % make install
  82. You can use "make PREFIX=/some/other/directory install" if you wish to use a
  83. different destination.
  84. Make install will just install binaries in your system, but will not configure
  85. init scripts and configuration files in the appropriate place. This is not
  86. needed if you want just to play a bit with Redis, but if you are installing
  87. it the proper way for a production system, we have a script doing this
  88. for Ubuntu and Debian systems:
  89. % cd utils
  90. % ./install_server.sh
  91. The script will ask you a few questions and will setup everything you need
  92. to run Redis properly as a background daemon that will start again on
  93. system reboots.
  94. You'll be able to stop and start Redis using the script named
  95. /etc/init.d/redis_<portnumber>, for instance /etc/init.d/redis_6379.
  96. Code contributions
  97. ---
  98. Note: by contributing code to the Redis project in any form, including sending
  99. a pull request via Github, a code fragment or patch via private email or
  100. public discussion groups, you agree to release your code under the terms
  101. of the BSD license that you can find in the COPYING file included in the Redis
  102. source distribution.
  103. Please see the CONTRIBUTING file in this source distribution for more
  104. information.
  105. Enjoy!