Created
October 20, 2017 08:02
-
-
Save caisan/efd158a059432d5e7618011a2edfbc5d to your computer and use it in GitHub Desktop.
create replica_set mongoDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TENANT_NAME= | |
ADMIN_USERNAME= | |
ADMIN_PASSWORD= | |
REQUEST="{\"auth\": {\"tenantName\":\"$TENANT_NAME\", \"passwordCredentials\": {\"username\": \"$ADMIN_USERNAME\", \"password\": \"$ADMIN_PASSWORD\"}}}" | |
RAW_TOKEN=`curl -s -d "$REQUEST" -H "Content-type: application/json" "http://{KeyStone_IP_ADDR:Port}/v2.0/tokens"` | |
TOKEN=`echo $RAW_TOKEN | python -c "import sys; import json; tok = json.loads(sys.stdin.read()); print tok['access']['token']['id'];"` | |
echo $TOKEN\ | |
curl -g -i -X POST http://{TroveAPI_IP_ADDR:Port}/v1.0/{Tentant_ID}/clusters \ | |
-H "User-Agent: trove keystoneauth1/2.20.0 python-requests/2.17.3 CPython/2.7.5" \ | |
-H "Content-Type: application/json" \ | |
-H "Accept: application/json" \ | |
-H "X-Auth-Token: ${TOKEN}" \ | |
-d '{"cluster": {"instances": [{"volume": {"size": "15"}, "nics": [{"net-id": "{Net-ID}"}], "flavorRef": "9"}, {"volume": {"size": "15"}, "nics": [{"net-id": "Net-ID"}], "flavorRef": "9"}, {"volume": {"size": "15"}, "nics": [{"net-id": "Net-ID"}], "flavorRef": "9"}], "datastore": {"version": "mongo3.2", "type": "mongodb"}, "name": "mongo3.2-rs1"}, "type":"replic_set"}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment