Here my requirement is, to start the couchbase server and import the json data into server using docker. for that i found script and added cbimport for json import, but getting error as :
*failed to connect to any of the specified hosts – plan.(data).execute() at data.go:70
Json import failed: failed to connect to any of the specified hosts
Here my script is :
! bash
/# Enables job control
set -m
/# Enables error propagation
set -e
/# Run the server and send it to the background
/entrypoint.sh couchbase-server &
/# Check if couchbase server is up
check_db() {
curl --silent http://127.0.0.1:8091/pools > /dev/null
echo $?
}
/# Variable used in echo
i=1
/# Echo with
log() {
echo "[$i] [$(date +"%T")] $@"
i=`expr $i + 1`
}
/# Wait until it's ready
until [[ $(check_db) = 0 ]]; do
>&2 log "Waiting for Couchbase Server to be available ..."
sleep 1
done
/# Setup index and memory quota
log "$(date +"%T") Init cluster ........."
curl -s -u Administrator:password -X POST http://localhost:8091/pools/default -d memoryQuota=512
couchbase-cli cluster-init -c 127.0.0.1 --cluster-username Administrator --cluster-password password \
--cluster-name myCluster --cluster-ramsize 256 --cluster-index-ramsize 256 --services data,index,query,fts \
--index-storage-setting default
/# Create the buckets
log "$(date +"%T") Create buckets ........."
couchbase-cli bucket-create -c 127.0.0.1 --username Administrator --password password --bucket-type couchbase --bucket-ramsize 250 --bucket sample
cbimport json -u Administrator -p password -b sample -c couchbase://127.0.0.1 -f lines -d file:///lines.json -g key::%name% -t 4
fg 1
docker command is :
docker run --name db13 --network my-network -p 8091-8094:8091-8094 -p 11210:11210 couchbase:latest
output is :
1] [22:31:14] Waiting for Couchbase Server to be available …
Starting Couchbase Server – Web UI available at http://<ip>:8091
and logs available in /opt/couchbase/var/lib/couchbase/logs
[2] [22:31:15] Waiting for Couchbase Server to be available …
[3] [22:31:16] Waiting for Couchbase Server to be available …
[4] [22:31:16] Waiting for Couchbase Server to be available …
[5] [22:31:18] Waiting for Couchbase Server to be available …
[6] [22:31:19] Waiting for Couchbase Server to be available …
[7] [22:31:20] Waiting for Couchbase Server to be available …
[8] [22:31:21] Waiting for Couchbase Server to be available …
[9] [22:31:22] Waiting for Couchbase Server to be available …
[10] [22:31:23] Waiting for Couchbase Server to be available …
[11] [22:31:24] 22:31:24 Init cluster …
SUCCESS: Cluster initialized
[12] [22:31:25] 22:31:25 Create buckets …
SUCCESS: Bucket created
2018-12-05T22:31:25.651+00:00 ERRO: failed to connect to any of the specified hosts – plan.(*data).execute() at data.go:70
Json import failed: failed to connect to any of the specified hosts
Please anybody help me out to solve the issue