Skip to content

Instantly share code, notes, and snippets.

@theriverman
Last active June 30, 2017 08:47
Show Gist options
  • Select an option

  • Save theriverman/16f06f13962aa6767b68d4f93c8f5074 to your computer and use it in GitHub Desktop.

Select an option

Save theriverman/16f06f13962aa6767b68d4f93c8f5074 to your computer and use it in GitHub Desktop.

Revisions

  1. theriverman renamed this gist Jun 30, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. theriverman revised this gist Jun 29, 2017. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,17 @@ DATABASES = {
    "PORT": "3306",
    },
    }
    ___________________________________________________________


    Replace the target database in common.py (try migrating database settings to local.py)

    sed -Ei 's/psql/psql-slave/g' psql_setting #Master to Slave

    sed -Ei 's/psql-slave/psql/g' psql_setting #Slave to Master

    # Exact match:
    sed -i 's/\<$basename\>/${basename}_yesterday/g' file.txt


    https://stackoverflow.com/questions/26608906/django-multiple-databases-fallback-to-master-if-slave-is-down
  3. theriverman created this gist Jun 29, 2017.
    19 changes: 19 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    DATABASES = {
    "follower": {
    "ENGINE": "django.db.backends.postgresql",
    "NAME": "follower",
    "USER": "root",
    "HOST": "54.34.65.24",
    "PORT": "3306",
    },
    "default": {
    "ENGINE": "django.db.backends.postgresql",
    "NAME": "application",
    "USER": "root",
    "HOST": "54.34.65.23",
    "PORT": "3306",
    },
    }


    https://stackoverflow.com/questions/26608906/django-multiple-databases-fallback-to-master-if-slave-is-down