-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcouchbase-init.sh
executable file
·42 lines (35 loc) · 1.44 KB
/
couchbase-init.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
COUCHBASE_CONTAINER="couchbase-db"
# Wait for Couchbase Server to be available
until curl -s http://127.0.0.1:8091/ui/index.html > /dev/null; do
echo "Waiting for Couchbase Server..."
sleep 5
done
docker exec $COUCHBASE_CONTAINER couchbase-cli cluster-init -c 127.0.0.1 \
--cluster-username Administrator \
--cluster-password password \
--services data,index,query \
--cluster-ramsize 4096 \
--cluster-index-ramsize 1024 \
--index-storage-setting default
# When there are millions of records in the db, memopt consumes a lot of RAM.
# --index-storage-setting memopt
docker exec $COUCHBASE_CONTAINER couchbase-cli bucket-create \
--cluster 127.0.0.1 \
--username Administrator \
--password password \
--bucket link-conversion \
--bucket-type couchbase \
--bucket-ramsize 2048 \
--bucket-replica 1
docker exec $COUCHBASE_CONTAINER couchbase-cli bucket-create \
--cluster 127.0.0.1 \
--username Administrator \
--password password \
--bucket link-conversion-failure \
--bucket-type couchbase \
--bucket-ramsize 512 \
--bucket-replica 1
# Rebalance the server before generating indexes
docker exec $COUCHBASE_CONTAINER couchbase-cli rebalance -c 127.0.0.1:8091 --username Administrator --password password
docker exec $COUCHBASE_CONTAINER cbq -s "CREATE INDEX shortlink_idx ON \`link-conversion\`(\`shortlink\`);" -u Administrator -p password -e 127.0.0.1:8093