Redis ERR unknown command 'FLUSHDB' - laravel

I deployed a laravel application into AWS EC2. The redis server is installed on another EC2 server.
The connection to the redis server is being initialized successfully. But, whenever I attempt to clear the cache, I get this error:
Predis\Response\ServerException : ERR unknown command 'FLUSHDB', with args beginning with:
If I install redis server locally on the application server, it works fine.
Any idea how to fix it?
P.S: I tried two versions of redis: 4.0.9 and 5.0.7 (both gave me the same error)

That means FLUSHDB has been disabled. This is a dangerous command, so many admin will disable this command by renaming the command with rename-command configuration in redis.conf or just disable it by rename it to empty string.
rename-command flushdb ""
Check the conf file for detail on command renaming.

Related

symfony server:start command throwing an error

I try to run
symfony server:start
It returns an error message
The local web server is already running for this project at port 8000
But lsof -wni tcp:8000 isn't returning anything, I'm sure there isn't any softwares using the port 8000.
Starting by doing
bin/console server:start
is working like a charm.
symfony server:start writes a pid file to ~/.symfony/var/.
Remove the correct pid file (i.e the one that references the current project dir)
You can make a
symfony server:stop
The system reboot and symfony serve will works again.

postgres bad connection localhost

On UBUNTU, I have a ruby app with a postgresql database on my localhost.
Everything was working fine yesterday, but today my database was gone. I was still able to open the app. Then I got an error saying something like,
run rails db:migrate
After I ran the command I started getting
PG::ConnectionBad at /
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
None of the config files were changed since yesterday.
I use docker-compose up to start the server and apparently it starts the connection but I still cannot access my localhost.
What could be the problem here?
Thank you in advance
Check the logs in your DB, if the DB is running on docker as well then maybe it's not finishing the DB boot correctly.
If this is the case, run the DB container manually first with the same options as in your docker-compose and then check docker logs for that container.

How to install Redis Sentinel as a Windows service?

I am trying to set up a redis sentinel as a windows service on a Azure VM (IaaS).
I am using the MS OpenTech port of Redis for Windows and running the following command...
redis-server --service-install --service-name rdsent redis.sentinel.conf --sentinel
This command installs the service on my system but when I try to start this service either through the services control panel or through the following command...
redis-server --service-run --service-name rdsent redis.sentinel.conf --sentinel
Then the service fails to start with the following error...
HandleServiceCommands: system error caught. error code=1063, message = StartServiceCtrlDispatcherA failed: unknown error
Am I missing something here?
Please someone help me start this service make it work properly.
I had the same problem, and mine was related to my sentinel config. A number of articles I have found have some incorrect examples, so my service install would not work until the configuration was correct. Anyway, here is what you need at a minimum for your sentinel config (for Windows Redis 2.8.17):
sentinel monitor <name of redis cache> <server IP> <port> 2
sentinel down-after-milliseconds <name of redis cache> 4000
sentinel failover-timeout <name of redis cache> 180000
sentinel parallel-syncs <name of redis cache> 1
Once you have that setup, the original Redis service command above will work.
According to MSOpenTech, the following command should install Redis Sentinel as a service:
redis-server --service-install --service-name Sentinel1 sentinel.1.conf --sentinel
But when I used that command the installed service wouldn't start: it would immediately fail with error 1067, "The process terminated unexpectedly." Looking at service entry I'm guessing the problem is that the --service-name parameter isn't being filtered and ends up as part of the service executable path.
What I did find to work is installing the service manually with the SC command:
SC CREATE Sentinel1 binpath= "\"C:\Program Files\Redis\redis-server.exe\" --service-run sentinel.1.conf --sentinel"
Don't forget the required space after "binpath=", and obviously that path will have to reflect where you've installed redis-server.exe. Also after the service installed I edited the service entry so Redis Sentinel would run under the Network Service account.
I am using v3.0.501 and ran into the two issues below. While present it caused the service to fail on start without an error written to either the file log or the Event Log.
The configuration file must be the last parameter of the command line. If another parameter was last, such as --service-name, it would run fine when invoked the command line but would consistently fail went started as a service.
Since the service installs a Network Service by default, ensure that it has access to the directory where the log file will be written.
Once these two items were accounted for the redis as a service run smooth as silk.
Recently, I have found a way how to setup windows service for Redis and Sentinel.
During my setup, I encountered similar problem. I finally figured it out: it was caused by the configuration file path.
I have put all my configuration into my github project: https://github.com/dingyuliang/Windows-Redis-Sentinel-Config

mongodb : listen() attempts to access socket in a forbidden way

I downloaded 64-bit zipped version of mongodb for windows, created '/data/db' as instructed.
Now, when I run "mongod" command, I am getting the following error & the mongodb server shuts down automatically.
"ERROR : listen() failed error-10013. An attempt was made to access socket in a way forbidden by its access permissions. "
Please help me to clear the firewall settings in windows to prevent this error & run mongodb.
I was able to fix the error by using the following command : "mongod --bind_ip="127.0.0.1". :)
This error also seems to happen when mongod is already running. On Windows 10, mongod will be listed under Background Processes in the Task Manager if it is running. If it is already running, ending the task should allow you to run mongod again without this error occurring. Also check that it is not running as a service; it may be set to restart automatically.
Also, if you have a docker container running mongodb, you also get this error. If you stop your container(s) running mongodb, then it should start up.
I was able to fix this issue by allowing access for Mongo Db Server Application under firewall settings in my antivirus settings.
After you did the above step,open the cmd as administrator and go to the bin path of mongodb application in your system.
Then run the below command.
mongod
Note : try the above steps only after you tried the below steps
1) https://docs.mongodb.com/manual/tutorial/configure-windows-netsh-firewall/
2)https://www.tomshardware.com/news/how-to-open-firewall-ports-in-windows-10,36451.html
I ran across a similar error which is why I ended up on this thread. For me, my solution was that McAfee Antivirus was blocking MongoDB.
The initial error basically showed that access was denied for mongo:
mongo error
I was able to do a search on the internet and found steps to allow MongoDB to run under McAfee Antivirus software by changing the setting for the app directly.
mcaffee settings
When I located MongoDB in the apps requesting internet access, it was initially set to blocked. I selected the app, clicked on edit and changed it to 'Designated ports'.
mongodb settings changed
Now, I am able to run mongo whether the mongod service is started automatically or if I start it manually in a hyper terminal window.

Configuring Redis on Windows

I'm using the MsOpenTech version of Redis on a Windows 2008 server. I've installed via the RedisWatcher Service as described here, and this is working fine - the server is responding and data going in and out nicely, running multiple instances etc - so great.
I have one problem though - i'm attempting to use a redis.conf file to set some default configuration; the .conf file being stored in the same directory as redis-server.exe, namely c:\redis\bin
The config changes themselves are straighforward, i'm simply setting timeout to 20 seconds, thus:
timeout 20
but when I run the watcher service, connect to the server via the command line and do config get timeout, it returns 0
I've tried to restart the watcher service after making the updates to config. I've tried passing in the timeout value directly in the watcher.conf file for the service, like
cmdparms --timeout 20
and this doesn't work. I've attempted the same on a second instance, same results.
Interestingly, if I start a second instance of the redis server within the watcher, thus:
{
workingdir c:\redis\inst2
runmode hidden
saveout 1
cmdparms --port 6380
}
this works, respecting the --port argument and kicking off a second instance at port 6380. Although as mentioned above, passing a --timeout parameter or a config file parameter to this instance is not working either.
Setting configuration via the command line works fine, ie, when connected to redis:
config set timeout 20
This sets the timeout as expected, but obviously doesn't persist the setting beyond that session. This being version 2.6 of redis, I don't have access to the config rewrite command, so can't get around it that way.
Any ideas welcome.
In the end the answer was simple. Restarting the RedisWatcher service does not restart the redis-server.exe process.
Manually stopping this process and restarting via the watcher made the config changes be picked up.

Resources