Go to file
Jim Brunner 0d7b2344b2
correct type internal to kvstore (minor) (#1246)
All of the internal variables related to number of dicts in the kvstore
are type `int`. Not sure why these 2 items were declared as `long long`.

Signed-off-by: Jim Brunner <brunnerj@amazon.com>
2024-11-01 15:16:18 -07:00
.config Rax size tracking (#688) 2024-10-02 19:28:55 +02:00
.github Mark main and serverAssert as weak symbols to be overridden (#1232) 2024-10-29 14:26:17 -07:00
deps Improved hashing algorithm in luaS_newlstr (#1168) 2024-10-15 15:18:58 -07:00
src correct type internal to kvstore (minor) (#1246) 2024-11-01 15:16:18 -07:00
tests Introduce bgsave cancel (#757) 2024-10-21 11:56:44 +02:00
utils clang-format: set ColumnLimit to 0 and reformat (#1045) 2024-09-25 01:22:54 +02:00
.git-blame-ignore-revs Added new reformat commit to .git-blame-ignore-revs (#1073) 2024-09-25 15:34:36 +08:00
.gitattributes Fix commands.c build issue on merge (#10172) 2022-01-25 12:24:06 +02:00
.gitignore Add tags into .gitignore (#1125) 2024-10-05 10:03:57 +02:00
00-RELEASENOTES Changed links and naming to valkey instead of redis (#389) 2024-05-02 14:53:37 +02:00
CODE_OF_CONDUCT.md Update CODE_OF_CONDUCT.md (#5) 2024-03-22 08:12:45 +01:00
codecov.yml Format yaml files (#615) 2024-06-14 13:40:06 -07:00
CONTRIBUTING.md Remove 'posting in the mailing list' in CONTRIBUTING.md (#1174) 2024-10-15 23:03:27 +02:00
COPYING Copyright update to reflect IP transfer from salvatore to Redis (#740) 2024-08-14 09:20:36 -07:00
GOVERNANCE.md Initial PR outlining the governance for the project (#345) 2024-04-30 14:57:21 -07:00
MAINTAINERS.md Initial PR outlining the governance for the project (#345) 2024-04-30 14:57:21 -07:00
Makefile Replace offensive term (#86) 2024-03-30 14:23:50 +01:00
README.md Fix casing in README.md (#1043) 2024-09-18 10:32:40 +08:00
runtest Replace Valkey in runtest scripts error prints (#190) 2024-04-03 16:17:38 -07:00
runtest-cluster Replace Valkey in runtest scripts error prints (#190) 2024-04-03 16:17:38 -07:00
runtest-moduleapi Add --moduleapi option to better use runtest-moduleapi (#1007) 2024-09-17 19:50:38 +08:00
runtest-rdma Introduce Valkey Over RDMA transport (experimental) (#477) 2024-07-15 14:04:22 +02:00
runtest-sentinel Replace Valkey in runtest scripts error prints (#190) 2024-04-03 16:17:38 -07:00
SECURITY.md Fix typo in SECURITY.md (#309) 2024-04-12 11:05:39 -04:00
sentinel.conf Fix default value of primary-reboot-down-after-period in sentinel.conf (#1040) 2024-09-21 21:09:13 +08:00
valkey.conf Document log format configs in valkey.conf (#1233) 2024-10-29 11:13:30 +01:00

codecov

This project was forked from the open source Redis project right before the transition to their new source available licenses.

This README is just a fast quick start document. More details can be found under valkey.io

What is Valkey?

Valkey is a high-performance data structure server that primarily serves key/value workloads. It supports a wide range of native structures and an extensible plugin system for adding new data structures and access patterns.

Building Valkey

Valkey can be compiled and used on Linux, OSX, OpenBSD, NetBSD, FreeBSD. We support big endian and little endian architectures, and both 32 bit and 64 bit systems.

It may compile on Solaris derived systems (for instance SmartOS) but our support for this platform is best effort and Valkey is not guaranteed to work as well as in Linux, OSX, and *BSD.

It is as simple as:

% make

To build with TLS support, you'll need OpenSSL development libraries (e.g. libssl-dev on Debian/Ubuntu).

To build TLS support as Valkey built-in:

% make BUILD_TLS=yes

To build TLS as Valkey module:

% make BUILD_TLS=module

Note that sentinel mode does not support TLS module.

To build with experimental RDMA support you'll need RDMA development libraries (e.g. librdmacm-dev and libibverbs-dev on Debian/Ubuntu). For now, Valkey only supports RDMA as connection module mode. Run:

% make BUILD_RDMA=module

To build with systemd support, you'll need systemd development libraries (such as libsystemd-dev on Debian/Ubuntu or systemd-devel on CentOS) and run:

% make USE_SYSTEMD=yes

To append a suffix to Valkey program names, use:

% make PROG_SUFFIX="-alt"

You can build a 32 bit Valkey binary using:

% make 32bit

After building Valkey, it is a good idea to test it using:

% make test

The above runs the main integration tests. Additional tests are started using:

% make test-unit     # Unit tests
% make test-modules  # Tests of the module API
% make test-sentinel # Valkey Sentinel integration tests
% make test-cluster  # Valkey Cluster integration tests

More about running the integration tests can be found in tests/README.md and for unit tests, see src/unit/README.md.

Fixing build problems with dependencies or cached build options

Valkey has some dependencies which are included in the deps directory. make does not automatically rebuild dependencies even if something in the source code of dependencies changes.

When you update the source code with git pull or when code inside the dependencies tree is modified in any other way, make sure to use the following command in order to really clean everything and rebuild from scratch:

% make distclean

This will clean: jemalloc, lua, hiredis, linenoise and other dependencies.

Also if you force certain build options like 32bit target, no C compiler optimizations (for debugging purposes), and other similar build time options, those options are cached indefinitely until you issue a make distclean command.

Fixing problems building 32 bit binaries

If after building Valkey with a 32 bit target you need to rebuild it with a 64 bit target, or the other way around, you need to perform a make distclean in the root directory of the Valkey distribution.

In case of build errors when trying to build a 32 bit binary of Valkey, try the following steps:

  • Install the package libc6-dev-i386 (also try g++-multilib).
  • Try using the following command line instead of make 32bit: make CFLAGS="-m32 -march=native" LDFLAGS="-m32"

Allocator

Selecting a non-default memory allocator when building Valkey is done by setting the MALLOC environment variable. Valkey is compiled and linked against libc malloc by default, with the exception of jemalloc being the default on Linux systems. This default was picked because jemalloc has proven to have fewer fragmentation problems than libc malloc.

To force compiling against libc malloc, use:

% make MALLOC=libc

To compile against jemalloc on Mac OS X systems, use:

% make MALLOC=jemalloc

Monotonic clock

By default, Valkey will build using the POSIX clock_gettime function as the monotonic clock source. On most modern systems, the internal processor clock can be used to improve performance. Cautions can be found here: http://oliveryang.net/2015/09/pitfalls-of-TSC-usage/

To build with support for the processor's internal instruction clock, use:

% make CFLAGS="-DUSE_PROCESSOR_CLOCK"

Verbose build

Valkey will build with a user-friendly colorized output by default. If you want to see a more verbose output, use the following:

% make V=1

Running Valkey

To run Valkey with the default configuration, just type:

% cd src
% ./valkey-server

If you want to provide your valkey.conf, you have to run it using an additional parameter (the path of the configuration file):

% cd src
% ./valkey-server /path/to/valkey.conf

It is possible to alter the Valkey configuration by passing parameters directly as options using the command line. Examples:

% ./valkey-server --port 9999 --replicaof 127.0.0.1 6379
% ./valkey-server /etc/valkey/6379.conf --loglevel debug

All the options in valkey.conf are also supported as options using the command line, with exactly the same name.

Running Valkey with TLS:

Running manually

To manually run a Valkey server with TLS mode (assuming ./gen-test-certs.sh was invoked so sample certificates/keys are available):

  • TLS built-in mode:

    ./src/valkey-server --tls-port 6379 --port 0 \
        --tls-cert-file ./tests/tls/valkey.crt \
        --tls-key-file ./tests/tls/valkey.key \
        --tls-ca-cert-file ./tests/tls/ca.crt
    
  • TLS module mode:

    ./src/valkey-server --tls-port 6379 --port 0 \
        --tls-cert-file ./tests/tls/valkey.crt \
        --tls-key-file ./tests/tls/valkey.key \
        --tls-ca-cert-file ./tests/tls/ca.crt \
        --loadmodule src/valkey-tls.so
    

Note that you can disable TCP by specifying --port 0 explicitly. It's also possible to have both TCP and TLS available at the same time, but you'll have to assign different ports.

Use valkey-cli to connect to the Valkey server:

./src/valkey-cli --tls \
    --cert ./tests/tls/valkey.crt \
    --key ./tests/tls/valkey.key \
    --cacert ./tests/tls/ca.crt

Specifying --tls-replication yes makes a replica connect to the primary.

Using --tls-cluster yes makes Valkey Cluster use TLS across nodes.

Running Valkey with RDMA:

Note that Valkey Over RDMA is an experimental feature. It may be changed or removed in any minor or major version. Currently, it is only supported on Linux.

To manually run a Valkey server with RDMA mode:

% ./src/valkey-server --protected-mode no \
     --loadmodule src/valkey-rdma.so bind=192.168.122.100 port=6379

It's possible to change bind address/port of RDMA by runtime command:

192.168.122.100:6379> CONFIG SET rdma.port 6380

It's also possible to have both RDMA and TCP available, and there is no conflict of TCP(6379) and RDMA(6379), Ex:

% ./src/valkey-server --protected-mode no \
     --loadmodule src/valkey-rdma.so bind=192.168.122.100 port=6379 \
     --port 6379

Note that the network card (192.168.122.100 of this example) should support RDMA. To test a server supports RDMA or not:

% rdma res show (a new version iproute2 package)

Or:

% ibv_devices

Playing with Valkey

You can use valkey-cli to play with Valkey. Start a valkey-server instance, then in another terminal try the following:

% cd src
% ./valkey-cli
valkey> ping
PONG
valkey> set foo bar
OK
valkey> get foo
"bar"
valkey> incr mycounter
(integer) 1
valkey> incr mycounter
(integer) 2
valkey>

Installing Valkey

In order to install Valkey binaries into /usr/local/bin, just use:

% make install

You can use make PREFIX=/some/other/directory install if you wish to use a different destination.

Note: For compatibility with Redis, we create symlinks from the Redis names (redis-server, redis-cli, etc.) to the Valkey binaries installed by make install. The symlinks are created in same directory as the Valkey binaries. The symlinks are removed when using make uninstall. The creation of the symlinks can be skipped by setting the makefile variable USE_REDIS_SYMLINKS=no.

make install will just install binaries in your system, but will not configure init scripts and configuration files in the appropriate place. This is not needed if you just want to play a bit with Valkey, but if you are installing it the proper way for a production system, we have a script that does this for Ubuntu and Debian systems:

% cd utils
% ./install_server.sh

Note: install_server.sh will not work on Mac OSX; it is built for Linux only.

The script will ask you a few questions and will setup everything you need to run Valkey properly as a background daemon that will start again on system reboots.

You'll be able to stop and start Valkey using the script named /etc/init.d/valkey_<portnumber>, for instance /etc/init.d/valkey_6379.

Code contributions

Please see the CONTRIBUTING.md. For security bugs and vulnerabilities, please see SECURITY.md.

Valkey is an open community project under LF Projects

Valkey a Series of LF Projects, LLC 2810 N Church St, PMB 57274 Wilmington, Delaware 19802-4447