Zum Inhalt springen

Create your first Key Value Store instance and connect to it

Zuletzt aktualisiert am

In this Getting started guide, you create and configure an instance. This guide shows the most common settings for a small developer environment. When following this guide, you work with the STACKIT Portal. Alternative tools are available to manage instances. For a deeper understanding, consult Create and manage instances for Key Value Store.

  1. Visit the STACKIT Portal
  2. On the sidebar click on Key Value Store.
  3. On the bar on the top click on Create Key Value Store.

After completing the steps, you see an overlay with three sections (General information, Plans and Custom parameters).

  • Either leave the name for the instance as it is or insert a custom one.
  • On Instance version, select the Key Value Store version you want to use. We recommend using the latest available version.
  • Leave the plan setting as it is (1 Node, 1 vCPU, 4 GB RAM and 10 GB Disk) unless you know in advance the exact resources required. You can only change the plan later within certain boundaries.
  • Leave the disk threshold settings as it is (80%).
  • Add your clients IPv4 address to the list of ACLs.

If you want to connect with the computer, with which you are browsing these docs, use Cloudflare’s IP trace tool to determine your IPv4 address. Open your browser of choice and visit the Cloudflare Trace Tool . Copy the value behind ip. It should look like xxx.xxx.xxx.xxx. Now append /32 to it and add it as an ACL entry. To do so, append it with a leading comma to the existing entries.

For a deeper understanding of ACL entries, visit Create and manage instances for Key Value Store.

After reviewing every setting, click on Order fee-based to create the instance. Then a confirmation appears indicating the instance is created. The instance is added to the list of instances. Within minutes, it switches from Processing to Active.

To make any changes to your instance, you need to select it. Click on the sidebar on Key Value Store and then on the created instance. The overview page of your instance is displayed.

  1. On the sidebar click on Credentials.
  2. Click on Create credentials.
  3. Copy the information from the popup to a safe location.
  4. Click on Close.

To connect to the instance, you need client software. In this guide we use Redis Insight. You can download it from the Redis Insight Download Page . An alternative is the valkey-cli command. Visit the Valkey CLI docs to get more information.

Follow the instructions of your Operating System to install the downloaded Redis Insight installation package. After successful installation open Redis Insight and add your connection:

  1. After opening Redis Insight click on + Add Redis database.
  2. Paste the connection URI/URL you obtained in the Create credentials section, into the Connection URL field.
  3. Then click on Connection Settings and switch to the Security tab Redis Insight general connection configuration Redis Insight SNI checkbox clicked
  4. Click on Use SNI and leave the prefilled field as it is.
  5. Ensure Use TLS is enabled.
  6. Click on Add Redis Database to establish the connection.

After your client has established a connection, you can insert sample leaderboard data as a real-world use case.

In the lower left click on >_ CLI and insert a set of four players and their score representing a leaderboard:

ZADD leaderboard 1200 "alice" 950 "bob" 1430 "carol" 500 "dave"

The database returns:

(integer) 4

Now let the database return the top three players:

ZREVRANGE leaderboard 0 2 WITHSCORES

The database returns:

1) "carol"
2) "1430"
3) "alice"
4) "1200"
5) "bob"
6) "950"

Now a player wins and 575 score points are added to their account:

ZINCRBY leaderboard 575 "dave"

The database returns the updated score from Dave:

"1075"

Now let the database return the top three players again:

ZREVRANGE leaderboard 0 2 WITHSCORES

The output is:

1) "carol"
2) "1430"
3) "alice"
4) "1200"
5) "dave"
6) "1075"

including Dave now in the top three.

In this example you ran basic commands with the Key Value Store. From here on, continue with the How-tos.