Skip to content

Instantly share code, notes, and snippets.

@aaronhurt
Created December 20, 2017 22:26
Show Gist options
  • Select an option

  • Save aaronhurt/34dba67de4d28d5e34b1168e66be2810 to your computer and use it in GitHub Desktop.

Select an option

Save aaronhurt/34dba67de4d28d5e34b1168e66be2810 to your computer and use it in GitHub Desktop.

Revisions

  1. aaronhurt created this gist Dec 20, 2017.
    32 changes: 32 additions & 0 deletions local-consul-cluster.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    alias the ips...
    ```text
    ifconfig lo0 inet 127.0.0.100 netmask 255.255.255.0 alias
    ifconfig lo0 inet 127.0.0.110 netmask 255.255.255.0 alias
    ifconfig lo0 inet 127.0.0.120 netmask 255.255.255.0 alias
    ifconfig lo0 inet 127.0.0.200 netmask 255.255.255.0 alias
    ifconfig lo0 inet 127.0.0.210 netmask 255.255.255.0 alias
    ifconfig lo0 inet 127.0.0.220 netmask 255.255.255.0 alias
    ```

    build the directory structure...
    ```text
    mkdir -p /tmp/c{100,110,120,200,210,220}
    ```

    first cluster...
    ```text
    consul agent -server -disable-host-node-id -bootstrap-expect=3 -datacenter=dc100 -bind=127.0.0.100 -client=127.0.0.100 -data-dir=/tmp/c100 -node=c100
    consul agent -server -disable-host-node-id -bootstrap-expect=3 -datacenter=dc100 -bind=127.0.0.110 -client=127.0.0.110 -data-dir=/tmp/c110 -node=c110
    consul agent -server -disable-host-node-id -bootstrap-expect=3 -datacenter=dc100 -bind=127.0.0.120 -client=127.0.0.120 -data-dir=/tmp/c120 -node=c120
    ```

    second cluster...
    ```text
    consul agent -server -disable-host-node-id -bootstrap-expect=3 -datacenter=dc200 -bind=127.0.0.200 -client=127.0.0.200 -data-dir=/tmp/c200 -node=c200
    consul agent -server -disable-host-node-id -bootstrap-expect=3 -datacenter=dc200 -bind=127.0.0.210 -client=127.0.0.210 -data-dir=/tmp/c210 -node=c210
    consul agent -server -disable-host-node-id -bootstrap-expect=3 -datacenter=dc200 -bind=127.0.0.220 -client=127.0.0.220 -data-dir=/tmp/c220 -node=c220
    ```

    cleanup to reset...
    ```text
    rm -rf /tmp/c1??/* /tmp/c2??/*