Skip to content

Instantly share code, notes, and snippets.

@mgttt
Last active February 24, 2020 11:22
Show Gist options
  • Select an option

  • Save mgttt/25bd4569e313e7f02e9fed72e6e542ff to your computer and use it in GitHub Desktop.

Select an option

Save mgttt/25bd4569e313e7f02e9fed72e6e542ff to your computer and use it in GitHub Desktop.
rethinkdb rdb

install

https://rethinkdb.com/docs/install/

osx

brew update && brew install rethinkdb

ubuntu

https://rethinkdb.com/docs/install/ubuntu/

source /etc/lsb-release && echo "deb https://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
wget -qO- https://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install rethinkdb

docker

docker run -d -P --name rethink1 rethinkdb

setup

secure

https://rethinkdb.com/docs/security/


docker run -d -P --env RDBPASS="CHANGEPASS" --env RDBCLUSTER="ZT1234" -v $PWD:/work/ -w /work/ rethinkdb \
rethinkdb --initial-password $RDBPASS --join $RDBCLUSTER -d ./rdbdata/

cli options

https://rethinkdb.com/docs/cli-options/

# using zt private and add zt ip to cf cdn:
## get zt ip
## add this ip to cloudflare ip

# health check routine to send email to admin?

@mgttt
Copy link
Author

mgttt commented Feb 24, 2020

check ip

echo change the config and start
RKVPASS=admin \
RKVCLUSTER=localhost \
CANONICAL=`curl http://checkip.amazonaws.com` \
docker run -ti -p 28015:28015 -p 29015:29015 -p 8888:8080 -e RKVPASS -e RKVCLUSTER -e CANONICAL -v $PWD:/work/ -w /work/ rethinkdb \
sh -c 'rethinkdb --initial-password "$RKVPASS" -d ./rdbdata/ --bind all --join "$RKVCLUSTER" --no-http-admin --canonical-address "$CANONICAL"'

@mgttt
Copy link
Author

mgttt commented Feb 24, 2020

RKVPASS= RKVCLUSTER= CANONICAL=`curl http://checkip.amazonaws.com` && \
rethinkdb --initial-password "$RKVPASS" --bind all --join "$RKVCLUSTER" --no-http-admin --canonical-address "$CANONICAL"

@mgttt
Copy link
Author

mgttt commented Feb 24, 2020

cat > start_rdb.sh <<EE
rethinkdb --initial-password "$2" -d ./rdbdata/ --bind all --join "$1" --no-http-admin --canonical-address "`curl http://checkip.amazonaws.com`'
EE

sh start_rdb.sh cluster pass

@mgttt
Copy link
Author

mgttt commented Feb 24, 2020

&& rethinkdb --initial-password "$RKVPASS" --bind all --join "$RKVCLUSTER" --no-http-admin --canonical-address "$CANONICAL" --cluster-port 9015 --driver-port 8015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment