I, [2018-06-19T18:01:55.777804 #13] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
Preformatted textNo connection to db, unable to retrieve site settings! (normal when running db:create) WARN: Redis is in a readonly state.' Performed a noop Failed to report error: Connection lost (ECONNRESET) 2 Dropping undeliverable message: ERR Error running script (call to f_b06356ba4628144e123b652c99605b873107c9be): @user_script:14: @user_script: 14: -READONLY You can't write against a read only slave.
I have rebooted my Elasticache and failed over… yet Redis remains in a read only state… any ideas?
Is your ElastiCache setup Multi-AZ? That message suggests you are connecting to a secondary node in a cluster. Double check that the hostname you are using is the Primary Endpoint of the cluster.
I’ve just tried to use an entirely different Redis cache and again the build failed.
My app.yml specifies the primary endpoint of the cluster.
So far I have no containers running, just postgreSQL and redis cache.
I am going to try and use a snapshot of RDS this morning with a new Redis cache but if that fails I am not sure what else I can do since I have no containers running to access the UI.
Why did Discourse suddenly go into read only mode without manual intervention?
The site can switch to read-only mode when databases return errors like “Redis is in a readonly state”.
There are multiple types of READONLY depending on the trigger. Discourse.disable_readonly_mode(Discourse::USER_READONLY_MODE_KEY) will only turn off one, you have to pass the other keys to turn off the other types.
When I had containers running, I disabled all three modes/keys you listed and it temporarily removed read only access and then returned back immediately. Hence why I have now moved onto trying to rebuild a different cache.
I had seen that the keys solution had worked for other people but for some reason it did not work for our application.
Thanks for the compliment. It’s nice to hear that the co-founder of Discourse/Stackoverflow considers our environment as enterprise even before it has been released
Problem solved. The issue was that Amazon Aurora was being used as RDS and by default this creates a cluster with two database instances inside - one primary and one replica.
Sometime yesterday an auto failover occurred and within our app.yml under the DISCOURSE_DB_HOST: parameter I had specified the DATABASE endpoint. Not the CLUSTER endpoint. The failover made the database endpoint specified in app.yml a read only replica, thus Discourse being locked into Read Only mode.
If anyone is running a similar setup:
EC2 instances with docker containers
Redis ElastiCache
Amazon Aurora RDS (PostgreSQL underneath)
Check that /var/discourse/containers/app.yml contains:
DISCOURSE_DB_HOST: RDS Cluster Endpoint (Go to RDS > Clusters > Access your cluster > Under Cluster endpoint is the endpoint you need to specify) DISCOURSE_DB_PORT: RDS Cluster Port DISCOURSE_REDIS_HOST: ElastiCache Primary Endpoint (Go to ElastiCache > Redis > Toggle the “play” shape button beside your Redis Cluster Name > Under Primary Endpoint is the endpoint you need to specify) DISCOURSE_REDIS_PORT: Redis Cluster Port
Hope this helps someone!
@codinghorror Is there a way to run ./launcher rebuild app without pulling down the latest codebase from Discourse?
That “tests-passed” refers to a specific branch on Git correct? As I can see other branches such as stable where there are still commits being issued quite frequently.
Is there anyway we can remain on a specific version of Discourse even when we run a container rebuild? We want to be able to control our main Discourse codebase and update/test it within a release environment before deploying to prod.
tests-passed will be the branch that is the most recent known working instance, not necessarily stable.
I would recomment you pin your dead containers to the version your active containers are on (you can probably see the version in your docker-manager) and then make these active first.
This is exactly why you’d pin your yml to only fetch a specific version, not tests-passed or stable.