valkey alternative to redis

This commit is contained in:
SheetJS 2024-04-23 13:36:01 -04:00
parent 01481c65cf
commit e273f11b46

@ -38,11 +38,12 @@ from XLSX files to a Redis database and to serialize a database to a workbook.
This demo was tested in the following environments:
| Server | Connector Module | Date |
|:--------------|:-------------------|:----------:|
| KeyDB `6.3.4` | `redis` (`4.6.13`) | 2024-03-25 |
| Redis `6.2.9` | `redis` (`4.6.11`) | 2023-12-04 |
| Redis `7.2.4` | `redis` (`4.6.11`) | 2024-03-26 |
| Server | Connector Module | Date |
|:---------------|:-------------------|:----------:|
| KeyDB `6.3.4` | `redis` (`4.6.13`) | 2024-04-23 |
| Redis `6.2.14` | `redis` (`4.6.13`) | 2024-04-23 |
| Redis `7.2.4` | `redis` (`4.6.13`) | 2024-04-23 |
| Valkey `7.2.5` | `redis` (`4.6.13`) | 2024-04-23 |
:::
@ -262,9 +263,49 @@ The following command started the server process:
keydb-server --protected-mode no
```
_Redis_
_Valkey_
Redis was installed with:
Valkey was installed with:
```bash
brew install valkey
```
:::caution pass
The Valkey formula will create symlinks to `redis-server` and other commands.
This conflicts with the main `redis` package. `redis` must be unlinked:
```bash
brew unlink redis
brew link valkey
```
:::
The following command started the server process:
```bash
redis-server /usr/local/etc/redis.conf
```
_Redis 6_
Redis 6 was installed with:
```bash
brew install redis@6.2
```
The following command started the server process:
```bash
redis-server /usr/local/etc/redis.conf
```
_Redis 7_
Redis 7 was installed with:
```bash
brew install redis@7.2
@ -273,9 +314,22 @@ brew install redis@7.2
The following command started the server process:
```bash
/usr/local/opt/redis/bin/redis-server /usr/local/etc/redis.conf
redis-server /usr/local/etc/redis.conf
```
:::danger pass
When the demo was last tested, Redis 7.2.4 was installed. The output from the
Redis server will display the version number:
```
69385:C 23 Apr 2024 13:24:48.520 * Redis version=7.2.4, bits=64, commit=00000000, modified=0, pid=69385, just started
```
Please raise an issue with Homebrew if a later version is installed.
:::
</details>
1) Download the following scripts:
@ -300,9 +354,55 @@ npm i --save https://cdn.sheetjs.com/xlsx-${current}/xlsx-${current}.tgz redis@4
node SheetJSRedisTest.mjs
```
**Testing**
Inspect the output and compare with the data in `SheetJSRedisTest.mjs`.
Open `SheetJSRedis.xlsx` and verify the columns have the correct data
<details>
<summary><b>Expected Output</b> (click to show)</summary>
```
SET [ 'baz', '0' ]
SET [ 'foo', 'bar' ]
HSET [
'user:1000',
{
name: 'John Smith',
email: 'john.smith@example.com',
password: 's3cret',
visits: '1'
}
]
HSET [
'user:1001',
{
name: 'Mary Jones',
email: 'mjones@example.com',
password: 'hunter2'
}
]
SADD [ 'superpowers', [ 'flight', 'x-ray vision' ] ]
SADD [ 'birdpowers', [ 'flight', 'pecking' ] ]
RPUSH [ 'friends', [ 'sam', 'alice', 'bob' ] ]
ZADD [
'hackers',
[
{ value: 'Grace Hopper', score: 1906 },
{ value: 'Alan Turing', score: 1912 },
{ value: 'Claude Shannon', score: 1916 },
{ value: 'Alan Kay', score: 1940 },
{ value: 'Richard Stallman', score: 1953 },
{ value: 'Sophie Wilson', score: 1957 },
{ value: 'Yukihiro Matsumoto', score: 1965 },
{ value: 'Linus Torvalds', score: 1969 }
]
]
```
</details>
Open `SheetJSRedis.xlsx` and verify the columns have the correct data. The sheet
should have the same structure as the screenshot at the top of this page.
[^1]: See ["Array of Arrays" in "Utility Functions"](/docs/api/utilities/array#array-of-arrays)
[^2]: See ["Array of Arrays Input" in "Utility Functions"](/docs/api/utilities/array#array-of-arrays-input).