-
Notifications
You must be signed in to change notification settings - Fork 0
FAQ
The best way to get started with RDS is to create your first instance:
- Create an instance using the
sudo rds create
command; - Start your instance with the command
sudo rds start <id>
, where<id>
is your instance ID; - Check the list of all instances using the
sudo rds list
command; - Stop your instance with the command
sudo rds stop <id>
; - Destroy your instance with
sudo rds destroy <id>
.
You can see a list of all available commands and arguments by running sudo rds --help
. You can also see detailed help for an individual command by running sudo rds help <command>
.
RDS automatically checks kernel, limits and THP settings when instances are created, started or restarted. You can also use the sudo rds -vv
command to check the settings.
RDS supports replication. By default, RDS clusters have 1 master and 1 minion (there can be as many minions as you like). The utility asks you about type of instance to put on the minion.
- S (standby) - an instance with the same settings as the master instance, but it doesn't synchronise with the master instance;
- R (replica) - a full replica of the instance on the master node, with data synchronised with the master instance.
Use the command sudo rds edit <id>
. One of the questions will be which replication type to use.
Remember that changing the replication type from replica
to standby
will remove all data from instances on minions.
The password is used for destructive commands (like deleting an instance), and for viewing private information about the instance.
For most commands, authorization is done by username and ownership of the instance. If you know the password to someone else's instance, you can perform destructive commands on it.
I tried to run a command (like FLUSHALL
, CONFIG
, SAVE
…), but redis-cli
says I don't have permission to do it. How can I run this command?
By default, RDS creates instances without permissions for @admin
and @dangerous
commands. To run forbidden commands, use the rds cli
command with the --private
/-p
option:
sudo rds cli -p 42:3 FLUSHDB ASYNC
If you have a superuser password (generated during configuration), use it with the command sudo rds edit <id>
. If you don't have this password, ask your DevOps engineer or system administrator (or the person who installed and configured RDS) to change your password (you can use this new password to change it to your own).
Superuser authentication information is stored in the su.dat
file in the RDS installation directory. Remove this file with sudo rm
and run sudo rds go
to generate a new superuser password.
Yes, there are some.
- If you need to create an instance to store session keys or queues that doesn't need to save data to disk, use the
--disable-saves
option when creating it. - If you need an instance with authorisation support, use the
--secure
switch, you will be asked for the authorisation password. - If you want to add some tags to your instance, use the
--tags
option when creating the instance.
I have an instance with hundreds of gigabytes of data that I don't need, should I stop it before deleting it?
No. Delete it immediately. Stopping the instance will start a saving process that you don't need. Deletion of a running instance will immediately send a KILL
signal to it. As a result, this instance will be deleted in a few seconds.
I want to deploy a new version of the service that may corrupt my data. Is there a way to back up my data?
Yep. You can use the sudo rds backup-create <id>' command to create a snapshot (_up to 10_) of the current instance data. If something goes wrong, you can restore your data with
sudo rds backup-restore '.
The list
command supports the ability to filter output. Here are some examples.
-
sudo rds list my
- shows your instances; -
sudo rds list my active
- shows your active instances; -
sudo rds list j.doe saving
- shows instances of userj.doe
that are currently saving data to disk.
Further examples and a list of all available filters can be viewed by running the command sudo rds help list
.
Firstly, you need a superuser password. Next, you can combine two features - the batch-edit
command and the raw output of the list
command.
sudo rds batch-edit $(sudo rds list bob)
In this example, the list
command returns the IDs of bob's instances to the batch-edit
input. Using batch-edit
you can change owner to john
.
RDS generates an instance configuration file from a template for a particular Redis version, located in the templates
directory inside the main RDS directory (/opt/rds
by default).
To generate unique settings, the instances to which we want to apply the settings must be tagged with unique tags (you can find more information about tags using the sudo rds help tags-add
command). Then we make some changes to the configuration template. You can read more about the template language here.
{{if .HasTag "limited"}}
maxmemory 5gb
{{end}}
As a result, if an instance has the tag limited
, the configuration file will be created with this condition. We can also, for example, set a limit of 10 gigabytes for instances without the tag:
{{if .HasTag "limited"}}
maxmemory 5gb
{{else}}
maxmemory 10gb
{{end}}
The important thing is not to forget to regenerate the configuration files of the instances that need these changes.
There are some important actions that need to be performed on the server or RDS, is there any way to restrict user actions at this point?
With the superuser password, you can enable or disable maintenance mode with the sudo rds maintenance
command. To enable maintenance mode run the next command:
sudo rds maintenance enable
After that, all RDS commands require the superuser password.
To enable maintenance mode run the next command:
sudo rds maintenance disable
I need to perform a lot of monotonous actions with a lot of instances, is there any way to automate this?
Yep. You can use bash and RDS I/O capabilities to do this. As a simple example, we have 20 instances tagged testing
. We want to regenerate configuration files for them and reload new configurations. This task could be solved with the following script:
for id in $(sudo rds list testing) ; do
sudo rds regen "$id" < ~/rds-su-password || exit 1
sudo rds reload "$id" < ~/rds-su-password || exit 1
done
In our loop, we use output from our list
command, but instead of showing a table with instances information, when we run it as part of a script (or pipe it with |
), it just returns a list of instance IDs that we can use. Next, we run the regen
and reload
commands on instance with given ID; both commands require a password, so we save the password to a file and pass it as input via stdin
to our command; at the same time, we added a condition at the end of each command call that if execution of any of the commands fails with an error code (the exit code is not 0
), we abort the script.
There are two ways to turn off ProTips in RDS. DevOps/System Administrators can completely disable ProTips in the RDS configuration file (/etc/rds.knf
):
# Disable ProTips
disable-tips: true
Users can turn off ProTips using a preferences file.