Skip to content

Instantly share code, notes, and snippets.

@lmmendes
Last active May 28, 2021 07:36
Show Gist options
  • Select an option

  • Save lmmendes/15c65fb77aec523e836d032b48eee77b to your computer and use it in GitHub Desktop.

Select an option

Save lmmendes/15c65fb77aec523e836d032b48eee77b to your computer and use it in GitHub Desktop.

Revisions

  1. lmmendes revised this gist May 9, 2016. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions elasticache_dump_to_rdb.md
    Original file line number Diff line number Diff line change
    @@ -31,19 +31,19 @@ Start save the sabe to the `dump.rdb` file

    ## Usefull commands

    # Fetch the number of keys inside the database
    Fetch the number of keys inside the database
    ````
    127.0.0.1:6379> DBSIZE
    ````

    # Find the location of the configuration file
    # we need this to find out where is Redis data folder
    Find the location of the configuration file
    we need this to find out where is Redis data folder
    ```
    $ redis-cli INFO | grep file
    config_file:/usr/local/etc/redis.conf
    ````
    # Location where the .rdb data files are stored
    Location where the .rdb data files are stored
    ```
    $ cat /usr/local/etc/redis.conf | grep dir --color
    dir /usr/local/var/db/redis/
  2. lmmendes revised this gist May 9, 2016. 1 changed file with 13 additions and 5 deletions.
    18 changes: 13 additions & 5 deletions elasticache_dump_to_rdb.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,7 @@
    ## Instructions to DUMP localy a Elasticache Redis database

    Connect to Redis CLI

    ```
    $ redis-cli
    ```
    @@ -18,24 +21,29 @@ Start save the sabe to the `dump.rdb` file
    127.0.0.1:6379> BGSAVE
    ```

    ````
    127.0.0.1:6379> DBSIZE
    ````

    ````
    127.0.0.1:6379> SLAVEOF NO ONE
    ````


    ```
    127.0.0.1:6379> EXIT
    ```

    ## Usefull commands

    # Fetch the number of keys inside the database
    ````
    127.0.0.1:6379> DBSIZE
    ````

    # Find the location of the configuration file
    # we need this to find out where is Redis data folder
    ```
    $ redis-cli INFO | grep file
    config_file:/usr/local/etc/redis.conf
    ````
    # Location where the .rdb data files are stored
    ```
    $ cat /usr/local/etc/redis.conf | grep dir --color
    dir /usr/local/var/db/redis/
  3. lmmendes revised this gist May 9, 2016. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions elasticache_dump_to_rdb.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    Connect to Redis CLI
    ```
    redis-cli
    $ redis-cli
    ```

    Enable the current redis as a slave for the master node
    @@ -32,11 +32,11 @@ Start save the sabe to the `dump.rdb` file
    ```

    ```
    127.0.0.1:6379> redis-cli INFO | grep file
    $ redis-cli INFO | grep file
    config_file:/usr/local/etc/redis.conf
    ````
    ```
    127.0.0.1:6379> cat /usr/local/etc/redis.conf | grep dir --color
    $ cat /usr/local/etc/redis.conf | grep dir --color
    dir /usr/local/var/db/redis/
    ```
  4. lmmendes revised this gist May 9, 2016. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion elasticache_dump_to_rdb.md
    Original file line number Diff line number Diff line change
    @@ -29,4 +29,14 @@ Start save the sabe to the `dump.rdb` file

    ```
    127.0.0.1:6379> EXIT
    ```
    ```

    ```
    127.0.0.1:6379> redis-cli INFO | grep file
    config_file:/usr/local/etc/redis.conf
    ````
    ```
    127.0.0.1:6379> cat /usr/local/etc/redis.conf | grep dir --color
    dir /usr/local/var/db/redis/
    ```
  5. lmmendes revised this gist May 9, 2016. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions elasticache_dump_to_rdb.md
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,15 @@ Start save the sabe to the `dump.rdb` file
    127.0.0.1:6379> BGSAVE
    ```

    ````
    127.0.0.1:6379> DBSIZE
    ````

    ````
    127.0.0.1:6379> SLAVEOF NO ONE
    ````


    ```
    127.0.0.1:6379> EXIT
    ```
  6. lmmendes revised this gist May 8, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions elasticache_dump_to_rdb.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    Connect to Redis CLI
    ```
    redis-cli
    ```
  7. lmmendes created this gist May 8, 2016.
    22 changes: 22 additions & 0 deletions elasticache_dump_to_rdb.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    ```
    redis-cli
    ```

    Enable the current redis as a slave for the master node
    ```
    127.0.0.1:6379> SLAVEOF master-node-address.0001.euw1.cache.amazonaws.com 6379
    ```

    Issue a `sync` command, starting sync operations
    ```
    127.0.0.1:6379> SYNC
    ```

    Start save the sabe to the `dump.rdb` file
    ```
    127.0.0.1:6379> BGSAVE
    ```

    ```
    127.0.0.1:6379> EXIT
    ```