Thông tin kết nối
Sơ đồ minh họa
Luồng thao tác chính (không phải ảnh Console)
Cache
GET/SET/session
Limits
Commands/bandwidth
Commands
Biết command bị chặn
Redis usage
1Commands 38%
2Bandwidth 22%
3Storage 14%
4Connections healthy
Vào database Redis trong Console, mở tab Connection rồi copy Host, Port, Username và Password. Username thường là `default`; password là giá trị Console cấp riêng cho database đó.
App chạy cùng organization với database dùng Private address và port trong Connection. Máy cá nhân hoặc client ngoài DLEZ dùng Public address. Giữ credential phía server; xem public/private network trước khi cấu hình. Các giá trị bên dưới là mẫu, hãy thay toàn bộ bằng thông tin Console.
REDIS_HOST="copy-host-from-console"
REDIS_PORT="6379"
REDIS_USERNAME="default"
REDIS_PASSWORD="copy-from-console"Node.js
npm install redis
import { createClient } from "redis";
const client = createClient({
username: process.env.REDIS_USERNAME,
password: process.env.REDIS_PASSWORD,
socket: {
host: process.env.REDIS_HOST,
port: Number(process.env.REDIS_PORT),
},
});
await client.connect();
await client.set("hello", "dlez");
console.log(await client.get("hello"));Go
go get github.com/redis/go-redis/v9
rdb := redis.NewClient(&redis.Options{
Addr: os.Getenv("REDIS_HOST") + ":" + os.Getenv("REDIS_PORT"),
Username: os.Getenv("REDIS_USERNAME"),
Password: os.Getenv("REDIS_PASSWORD"),
})