> For the complete documentation index, see [llms.txt](https://courier-gojek.gitbook.io/vernemq/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://courier-gojek.gitbook.io/vernemq/configuring-vernemq/routing.md).

# Redis based subscription store

One of the problems that we tried to address was that of subscription state not syncing when one of the nodes restarted. The subscription state used to build up on other nodes and the restarted node was unable to catch up to the other nodes. We finally achieved this using an external store(redis) for maintaining a common subscription state for all the nodes.

You can use the redis based external subscription store using the following configs as mentioned below:

### Default Reg trie

You have to configure the default\_reg\_view to vmq\_reg\_redis\_trie to start using redis store as the subscription store.

```
default_reg_view = vmq_reg_redis_trie
```

### Lua directory

By default, we use a set of lua scripts that are loaded into `/etc/lua` inside the `_build/default/rel/vernemq` when a release is created using `make rel`. This value can be overridden if you wish to use a different set of scripts.

```
redis_lua_dir = ./etc/lua
```

### Redis database

Redis databases are numbered from 0 to 15 and, by default, you connect to database 0 when you connect to your Redis instance. However, you can change the database you’re using with the select command after you connect. This config specifies which redis\_database to use. By default, you always connect to database 0.

```
redis_database = 0
```

### Redis sentinel endpoints

The address of redis sentinel endpoints.

```
redis_sentinel_endpoints = [{"vernemq-redis-1", 26379}, {"vernemq-redis-2", 26379}, {"vernemq-redis-3", 26379}]
```
