I am using redis database in my project and hosted it on aws. It is working fine for few days like 2-3 days but after that all the data are flushed automatically from redis. But my redis service is woking fine. Please reply on this issue as soon as possible
Comment From: misiek08
Probably your Redis is accessible for anyone by public IP and some not is flushing it. Limit access by firewall rules or make it listen on local address only.
Comment From: aakashgupta96
Hey! I am also facing the same issue. Did you find something that was causing this to happen?
Comment From: badboy
Redis itself does not suddenly flush its data.
Check connections to Redis, if it is publicly reachable and maybe use MONITOR to see sent commands, maybe some rogue client is causing this.
Comment From: ksushilmaurya
check your flushAll count. It will help you to track.
On Tue, Apr 25, 2017 at 1:40 PM, Jan-Erik Rediger notifications@github.com wrote:
Redis itself does not suddenly flush its data. Check connections to Redis, if it is publicly reachable and maybe use MONITOR to see sent commands, maybe some rogue client is causing this.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/antirez/redis/issues/3304#issuecomment-296953821, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOf6xK0dGdWj4fIBtycEy1bBiFTLri7ks5rzap4gaJpZM4IwnQX .
-- Regard Sushil Kumar
Comment From: aakashgupta96
Can you tell me command for checking flushAll count ?
Comment From: ksushilmaurya
Just run info all command on redis terminal. you will get this -
Commandstats
cmdstat_get:calls=2,usec=18,usec_per_call=9.00 cmdstat_set:calls=1,usec=13,usec_per_call=13.00 cmdstat_flushall:calls=1,usec=102327,usec_per_call=102327.00 ------- this is flush all count which is 1 cmdstat_info:calls=4,usec=1701,usec_per_call=425.25 cmdstat_monitor:calls=1,usec=6,usec_per_call=6.00
On Tue, Apr 25, 2017 at 3:10 PM, Aakash Gupta notifications@github.com wrote:
Can you tell me command for checking flushAll count ?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/antirez/redis/issues/3304#issuecomment-296975689, or mute the thread https://github.com/notifications/unsubscribe-auth/ALOf63svNG2YzvW2tpmDylELHFmo_babks5rzb-pgaJpZM4IwnQX .
-- Regard Sushil Kumar
Comment From: aakashgupta96
I tried this and got that flushall count is zero as this command was not mentioned in the output. Still unable to find out the reason for db flush. For further protection, I have added requirepass to redis-conf and would comment here if problem still persists. Thanks for the help.
Comment From: bilalabbasi55
Did anyone found the result of this issue, i am also using amazon EC2, and gets the data flush after 1,2 days, i) i have blocked the public access to the server ii) No Flushall executed iii) No server restart, server is up for more than 4 days, its showing me in systemctl status redis. iv) Master-Slave is running perfect(just to tell if some thing went wrong sentinel must have shifted the master)
Looking forward
Comment From: nswarnkar
@bilalabbasi55 , We too are facing this issue on EC2. What we are observing the flushall being called in a 1 day or so. and there is left an entry with key "redisX". we have no clue about this.
.For stopping notorious programs/users, firewall rules can be worked. Other workaround could be to either use password for redis. No client can call any command(if firewall is still allowing all to connect) without knowing the password.
One more option could be to rename flushall command, if you dont need to flush by yourself.
Comment From: callmylist
@nswarnkar Thanks alot for your comment, i do agree about all of the listed points that can cause db flush. But in my specific case(just to let others know) developer was doing db flush before new deployment on the server(yeah very basic mistake), Anyway thanks for your time.
Regards Abbasi
Comment From: Shubham3521
I was having the same issue with my redis-server also , data was getting automatically flushed after few hours . So I took the following step 1.First go to the redis-cli and then type "CONFIG GET dir" , If there is no "var/log/redis" present than your redis-cli is compromised. 2.You need to authenticate your redis-cli , you can do this by un-commenting a parameter "requirepass" in redis.conf and then adding a password , Make sure your password is strong enough. 3.Restart the redis server. 4.Now open redis-cli and type auth followed by your password. 5.You will now able to insert a command in it .
Hope this helps !
Comment From: hamidatjajiga
I had the same problem but it was a flush in my Laravel's service provider that was added by another developer.
I recommend you to use redis-cli monitor to see the access logs and troubleshoot the problem. I found this way helpful.
Thank you all
Comment From: ruubyy
Hey @bilalabbasi55 what was the issue, we have the same issue that redis-sentinel being flushed out suddenly. Redis flushall count is zero. We have 3 redis and redis-sentinel instances in 3 EC2s.
Comment From: bilalabbasi55
@ruubyy When we debugged that, it was some flushdb command that was getting executed with a cron, that was not an issue on redis side. You can enable some more detailed logging and check what command gets executed that flushes the data out of system. In our case logs helped us to debug this issue. Best of luck.
Comment From: evan-vivasoft
We had same issue like @bilalabbasi55 . A cron job was running flush command after some period of times. It was not an issue with redis. You can monitor the logs for a better understanding of the situation. Also check if your redis server's port is open or not and ensure that its password protected. Some bots may scan open ports and run unwanted commands in your redis server if its not password protected.