- Print
- PDF
Using Redis server images
- Print
- PDF
We are preparing a localization service for the content. We will do our best to provide the localization service as soon as possible.
Available in Classic
Introduction to Redis
Redis (Remote Dictionary Server) is an open source based in memory data structure store.
It provides data structures such as strings, hashes, lists, sets, and sorted sets, and stores data in the form of keys / values rather than relational database management systems (RDBMSs).
Persistent data can be provided, but it is used a lot in the form of cache that can be used with fast performance.
Salvatore Sanfilippo released the initial version in 2009 and is the most used database in the cache area, which is consistently ranked within 10 volumes of the worldwide database ranking.
Naver Cloud provides Redis 4.0 and supports pre-installed images at the Basic Install level.
"Redis" relies on Redis, an open source memory data structure repository used as a database, cache, and message broker.
NAVER Cloud Platform's self-hosted Redis service configuration
Self-hosted service
In case of self-hosted Redis service supported by NAVER CLOUD, only basic installation function is supported, so it supports only Redis Daemon startup state.
- We do not provide technical support for anything other than the installation provided in this regard.
Installation Version
For the image, it is a redis 4.0 compiled version provided by the redis official site and installed with the default path.
Installation directory
The directory and installation files are defined as 6379, which is the default redis port .
- Configuration file : /etc/redis/6379.conf
- Log file : /var/log/redis_6379.log
- Data file : /var/lib/redis/6379/dump.rdb
Setting kernel parameters for redis
The OS kernel parameters of the NAVER Cloud Platform Redis installation type are set as follows.
- vm.overcommit_memory=1
- net.core.somaxconn = 65535
Redis parameters settings
Naver Cloud's Redis parameter is the default setting and you can change the settings according to your needs. Redis restart is required after the change and the default configuration file is located in /etc/redis/6379.conf.
① bind (127.0.0.1)
This setting allows you to specify the network interface that can access Redis. The default is 127.0.1, so only local access is possible.
To make it accessible from the outside, set the IP that can communicate with the outside as shown below.
bind 10.33.2.74
If you don't need bind setting, you can disable protected-mode after comment (#) processing as below.
# bind 127.0.0.1
② protected-mode(yes)
This parameter determines whether protected-mode. If it is linked with bind configuration and enabled, command will not be executed when accessing redis externally even if bind configuration is disabled.
③ port (6379)
The default port is 6379. If there is a port you want, you can modify it.
④ stop-writes-on-bgsave-error (yes)
If write to rdb file (Data file) fails, read_only works only to prevent writing. If you need to write in any case, change it to no.
⑤ Maxmemory (No setting)
The parameter is disabled and there is no memory limit in this case. If you want to limit the memory to use, you can specify the value.
Server creation and initial access procedure
Create server
Here's how to create a server with a Redis image installed :
Step 1. www.ncloud.com connect And Login
① Select the console in the upper right corner to access the Console.
Step 2. Create server
① Click the [Create Server] icon.
Step 3. Select server image
① Select boot disk type 50GB, image type DBMS, DBMS image type Redis.
② Click [Next] of the REDIS mail corresponding to the desired OS Version.
Step 4. Server settings
① Set the desired server type.
② Enter the desired server name.
③ Click [Next].
Step 5. Authentication Key Setting
In the authentication key setting step, you can create a new authentication key or use an existing authentication key.
① The first time the user selects Create a new authorization key and enters the authorization key name.
② You entered an authentication key with the name redis.
③ Click [Create and save an authentication key] and save the downloaded redis.pem file in a safe place.
- This file will be used to generate passwords for the server in the future.
- Even if you use the same pem file, each server generates a different password.
④ Click [Next].
Step 6. Firewall settings
In Firewall Settings, you create an Access Control Group (ACG) or select a retaining ACG.
① If you are creating for the first time, click [Create ACG].
② ACG name
Enter a suitable name. You have entered redis-acg.
③ Access source
Enter the IP or band where you are trying to access. For example, enter 10.64.51.205 for a single IP, or 10.64.51.0/24 if you need all access in the 10.64.51.XXX band.
If the internal private IP goes out through NAT, you need to enter the public IP. You entered 0.0.0.0/0.
④ Allowed port
If you want to open a port individually, enter the required port number in the Allowed Ports (Service) and click the Add button. If you need more than one port, add a line and enter it.To open all ports, type 1-65535. However, this leaves the server vulnerable to security. You entered 1-65535.
⑤ Click the [add] icon on the right.
⑥ Check the final settings of the server to be created.
⑦ Click [Create].
Step 7. Final confirmation
After going through the steps above, the pem key file should be kept in a safe place on my computer, and remember the ACG settings. Note that the server you created cannot be accessed without the pem key.
① Click the [Create Server] icon.
② Wait for the server to be created.
Check server password
① Select the server you want.
② On the [Manage servers] menu, click Get admin password.
③ Select part 3 to upload redis.pem.
④ Click [Get admin password].
⑤ The administrator password provided at the time of initial creation is displayed.
- The first time you log in, you can access it using the above password, and change the password on the server for future management.
Terminal connection using port forwarding
① Enter the server's connection information.
- PORT : Port number set by port forwarding (example: 1234)
- Public IP : Public IP (for example, 1.255.57.22) for server access as shown in the port forwarding screen.
② Click on [Open] to connect.
③ Click [Yes] to connect.
④ Enter the account name root.
⑤ Enter the password confirmed in Admin Password.
Redis usage
Redis connection
Connect to Redis with the command below. Note that initial Redis connection is only available in Local (see bind configuration).
Stop and restart Redis
You can stop and start Redis with the command below.
Access from outside Redis
If accessing from outside Naver Cloud, public IP is required.
① Click [Allocated New IP].
- You can apply for as many public IPs as you have.
② Select the server you created from the Apply Server Selection drop-down.
③ Click [Next].
④ Click [Create].
- Redis default setting is local access only, so you must disable bind and proteced-mode to access from outside. Please refer to 1.2.5 Redis parameter setting method for deactivation.
Redis monitoring
Use the redis-cli info command to check the redis status information as shown below. Refer to INFO - Redis for the meaning of each item.
Back up
Redis is memory based, but data can be backed up.
① The bgsave command lowers the data in memory to Disk.
② Check the log file to verify that the operation is complete.
③ Keep the /var/lib/redis/6379/dump.rdb file safe.
NAVER Cloud Platform supports separate storage, so you can add a backup story to backup. For more information, please refer to Storage Addition Guide
Return Server Image
① Click the [Stop] button.
② Click the [Yes] button.
③ When the server is stopped, the Return button becomes active and clicks it.
④ Click the [Yes] button to complete the return.