2025-02-04

Valkey database

在更新 thiredis 之後,需要測試 thiredis 的關係,所以需要一個 Redis 協定相容的資料庫,openSUSE 目前採用的是 Valkey,所以筆記一下他的安裝部份。


Valkey is an open-source in-memory storage, used as a distributed, in-memory key–value database, cache and message broker, with optional durability.

在 openSUSE 安裝的指令:

sudo zypper in valkey

而下面是 README.SUSE 的簡要內容。需要使用 root 的權限進行設定。

  1. cp -a /etc/valkey/default.conf.example /etc/valkey/instancename.conf

    使用 -a 是因為要保留檔案的 permissions 設定,如果沒有使用,也可以使用下列的指令設定:
    chown root:valkey /etc/valkey/sentinel-instancename.conf
    chmod u=rw,g=rw,o= /etc/valkey/sentinel-instancename.conf

  2. change at least pidfile, logfile and dir setting

    pidfile /run/valkey/instancename.pid
    logfile /var/log/valkey/instancename.log
    dir /var/lib/valkey/instancename/

  3. create the database dir:
    install -d -o valkey -g valkey -m 0750 /var/lib/valkey/instancename/

  4. systemctl start valkey@instancename
  5. systemctl enable valkey@instancename
    (optional: 設定開機會啟動 valkey)

  6. To stop/restart all instances at the same time use:
    systemctl restart valkey.target
    systemctl stop valkey.target

如果要查看目前的狀態,使用:

sudo systemctl status valkey@instancename

相關連結

沒有留言: