Unable to copy data from one redis server to another - redis

I have redis db in stage whose data I want to copy in dev server. I tried copying data using SLAVEOF command as well as SAVE command.
Both stage and dev are clustered redis servers.
Both commands are giving errors:
SLAVEOF:
# running in dev server
host-dev.redis.db:6379> SLAVEOF host-stage.redis.db 6379
(error) ERR unknown command `SLAVEOF`, with args beginning with: `host-dev.redis.db`, `6379`,
SAVE
# running in stage server
host-stage.redis.db:6379> SAVE
(error) ERR unknown command `SAVE`, with args beginning with:
Am I missing something with these commands in the case of clustered redis servers? Or these errors are due to some missing config?

Related

gitlab CI/Ci runner is failing to failing to start redis server

I am trying to run a gitlab CI/CD pipeline but job to run the text script is failing due to redis server failing to start, I am getting an error saying
Starting redis ... error
ERROR: for redis Cannot start service redis: driver failed programming external connectivity on endpoint redis (8c425d45729aecef06c5c15b082ac96867a73986400f5c8bae29ebab55eb5fdf): Error starting userland proxy: listen tcp 0.0.0.0:6379: bind: address already in
I have tried run gitlab-runner restart command from terminal but the job is still failing
I al tried setting the Maximum job timeout to 10 mins but the job is still persisting

redis snapshot location not as specified in config

After running fine for a while, I am getting write error on my redis instance:
(error) MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.
In the log I see:
9948:C 22 Mar 20:49:32.241 # Failed opening the RDB file root (in server root dir /var/spool/cron) for saving: Read-only file system
However, my redis config file is /etc/redis/redis.conf as confirmed by:
redis-cli -p 6379 info | grep 'config_file'
config_file:/etc/redis/redis.conf
And there I have:
dir /mnt/data/redis
And indeed, there is a snapshot there.
But despite the above, redis now thinks my data directory is
redis-cli -p 6379 CONFIG GET dir
1) "dir"
2) "/var/spool/cron"
Corresponding to the error I was getting as quoted above.
Can anyone tell me why/how my data directory is changing after redis starts, such that it is no longer what is specified in the config file?
So the answer is that the redis server was hacked and the configuration changed, which is very easy to do as it turns out. (I should point out that I had no reason to think it wasn't easy to do. I just assumed security by obscurity was sufficient in this case--wrong. No matter, this was just a playground not any sort of production server).
So don't open your redis port to the world. Use security groups if on AWS to limit access to machines that need it, or use AUTH (which is still not awesome because then all clients need to know the single password which also apparently gets sent in the clear), or have some middleware controlling access.
Hacking redis is easy to do, can compromise your data, and even enable unauthorized SSH access to your server. And that's why you shouldn't highline.

Configuration of Running Redis Instance in Swisscom CloudFoundry

I am trying to read the configuration of the running Redis instance. I want to better understand how Redis is configured, especially in regard to persistence settings.
I have successfully connected to the running Redis instance (SSH tunnel) and try to execute the following command:
CONFIG GET *
CONFIG GET appendonly
However, I get the message
ERR unknown command 'CONFIG'
If I invoke the command "CONFIG GET" without any parameters I get the message
Invalid input argument for command: 'CONFIG GET', passed 0 arguments, must be in range 1 - 1
So the command is known. Seems to be a permission issue!? Is there a way to get the configuration?
The current Redis offering (march 2019) has the following settings for persistency:
appendonly yes
appendfsync everysec
It runs with 2 replicas.
Please note that this allies to the current service offering of Swisscom and might change in the future.

facing the problems with dns-api-go setup in google cloud

I created the Ubuntu virtual machine on that I created the Go environment after that I successfully imported and installed the skx/dns-api-go
I followed this doc: https://github.com/skx/dns-api-go for to set up the environment also I installed the required dependencies like
Dancer,Plack::Middle ware::Throttle::Lite,Net::DNS::Resolver,twiggy,
libdancer-perl ,libnet-cidr-lite-perl ,
libplack-middleware-reverseproxy-perl.
after that, at last, I run the following command:
dns-api-go -redis-server localhost:6379
then am getting the following result :
Launching the server on http://127.0.0.1:9999 redis: 2018/09/25
11:18:56 ring.go:263: ring shard state changed: Redis is down.
when I changed the port number in web preview in cloud shell it is showing as your server is not listing to 6379 port number, but in the instance level when I run the netstat -an command it is showing as the server is listing for 6379 port
please help me in resolving these issue.
6379 is redis server port which is there for rate limiting feature. If you go through the main.go file, you'll see go server port is 9999. Just run "dns-api-go" command and hit http://localhost:9999/

Copy redis database (.rdb file) from a remote server to local

I was given a Redis server that is set up remotely.
I can access data in that and I can do CRUD operation with that server.
But I want the replica of the same database in my local.
I have Redis desktop manager setup in my local. And also redis-server setup running.
Things I have tried:
using SAVE command.
I have connected to the remote server and executed save command. It ran
successfully and created dump.rdb file on that server. But I can't access that file as I don't have permission for server FTP.
using BGSAVE
same scenario here also
using redis-cli command
redis-cli -h server ip -p 6379 save > \\local ip\dump.rdb
Here I got an error The network name cannot be found.
Can anyone please suggest me on how can I copy the .rdb file from the server to local?