2
0

README 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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 build problems with dependencies or cached build options
  19. —--------
  20. Redis has some dependencies which are included into the "deps" directory.
  21. "make" does not rebuild dependencies automatically, even if something in the
  22. source code of dependencies is changes.
  23. When you update the source code with `git pull` or when code inside the
  24. dependencies tree is modified in any other way, make sure to use the following
  25. command in order to really clean everything and rebuild from scratch:
  26. make distclean
  27. This will clean: jemalloc, lua, hiredis, linenoise.
  28. Also if you force certain build options like 32bit target, no C compiler
  29. optimizations (for debugging purposes), and other similar build time options,
  30. those options are cached indefinitely until you issue a "make distclean"
  31. command.
  32. Fixing problems building 32 bit binaries
  33. ---------
  34. If after building Redis with a 32 bit target you need to rebuild it
  35. with a 64 bit target, or the other way around, you need to perform a
  36. "make distclean" in the root directory of the Redis distribution.
  37. In case of build errors when trying to build a 32 bit binary of Redis, try
  38. the following steps:
  39. * Install the packages libc6-dev-i386 (also try g++-multilib).
  40. * Try using the following command line instead of "make 32bit":
  41. make CFLAGS="-m32 -march=native" LDFLAGS="-m32"
  42. Allocator
  43. ---------
  44. Selecting a non-default memory allocator when building Redis is done by setting
  45. the `MALLOC` environment variable. Redis is compiled and linked against libc
  46. malloc by default, with the exception of jemalloc being the default on Linux
  47. systems. This default was picked because jemalloc has proven to have fewer
  48. fragmentation problems than libc malloc.
  49. To force compiling against libc malloc, use:
  50. % make MALLOC=libc
  51. To compile against jemalloc on Mac OS X systems, use:
  52. % make MALLOC=jemalloc
  53. Verbose build
  54. -------------
  55. Redis will build with a user friendly colorized output by default.
  56. If you want to see a more verbose output use the following:
  57. % make V=1
  58. Running Redis
  59. -------------
  60. To run Redis with the default configuration just type:
  61. % cd src
  62. % ./redis-server
  63. If you want to provide your redis.conf, you have to run it using an additional
  64. parameter (the path of the configuration file):
  65. % cd src
  66. % ./redis-server /path/to/redis.conf
  67. It is possible to alter the Redis configuration passing parameters directly
  68. as options using the command line. Examples:
  69. % ./redis-server --port 9999 --slaveof 127.0.0.1 6379
  70. % ./redis-server /etc/redis/6379.conf --loglevel debug
  71. All the options in redis.conf are also supported as options using the command
  72. line, with exactly the same name.
  73. Playing with Redis
  74. ------------------
  75. You can use redis-cli to play with Redis. Start a redis-server instance,
  76. then in another terminal try the following:
  77. % cd src
  78. % ./redis-cli
  79. redis> ping
  80. PONG
  81. redis> set foo bar
  82. OK
  83. redis> get foo
  84. "bar"
  85. redis> incr mycounter
  86. (integer) 1
  87. redis> incr mycounter
  88. (integer) 2
  89. redis>
  90. You can find the list of all the available commands here:
  91. http://redis.io/commands
  92. Installing Redis
  93. -----------------
  94. In order to install Redis binaries into /usr/local/bin just use:
  95. % make install
  96. You can use "make PREFIX=/some/other/directory install" if you wish to use a
  97. different destination.
  98. Make install will just install binaries in your system, but will not configure
  99. init scripts and configuration files in the appropriate place. This is not
  100. needed if you want just to play a bit with Redis, but if you are installing
  101. it the proper way for a production system, we have a script doing this
  102. for Ubuntu and Debian systems:
  103. % cd utils
  104. % ./install_server.sh
  105. The script will ask you a few questions and will setup everything you need
  106. to run Redis properly as a background daemon that will start again on
  107. system reboots.
  108. You'll be able to stop and start Redis using the script named
  109. /etc/init.d/redis_<portnumber>, for instance /etc/init.d/redis_6379.
  110. Code contributions
  111. ---
  112. Note: by contributing code to the Redis project in any form, including sending
  113. a pull request via Github, a code fragment or patch via private email or
  114. public discussion groups, you agree to release your code under the terms
  115. of the BSD license that you can find in the COPYING file included in the Redis
  116. source distribution.
  117. Please see the CONTRIBUTING file in this source distribution for more
  118. information.
  119. Enjoy!