@@ -17,14 +17,14 @@ CRATEDB_IMAGE=${CRATEDB_IMAGE:-crate:4.8.1}
17
17
# 0. Define incantations.
18
18
crash=" docker run --interactive --rm --network=host ${CRATEDB_IMAGE} crash"
19
19
cratedb_start=" docker run --detach --rm --publish=4200:4200 --publish=5432:5432 --health-cmd=\" curl http://localhost:4200\" --health-interval=1s --health-start-period=5s --health-retries=15 --name=${CONTAINER_NAME} ${CRATEDB_IMAGE} -Cdiscovery.type=single-node"
20
- cratedb_stop=" docker stop ${CONTAINER_NAME} "
20
+ cratedb_stop=" docker rm ${CONTAINER_NAME} --force "
21
21
cratedb_status=" docker inspect -f {{.State.Health.Status}} ${CONTAINER_NAME} "
22
22
echo=$( which echo)
23
23
24
24
# 1. Start CrateDB and wait for availability.
25
25
$cratedb_status > /dev/null 2>&1
26
26
if [ $? -ne 0 ]; then
27
- echo " Starting CrateDB."
27
+ echo " Starting CrateDB ' ${CRATEDB_IMAGE} ' ."
28
28
sh -c " $cratedb_start "
29
29
else
30
30
echo " CrateDB already started."
@@ -37,11 +37,30 @@ done;
37
37
echo
38
38
39
39
# 2. Insert NYC Yellowcab data.
40
- echo " Importing NYC Yellowcab data. This will take a few seconds/minutes."
40
+ echo " Importing NYC Yellowcab data."
41
+ echo " This will take a few seconds or minutes, depending on system performance and network speed."
41
42
time $crash << EOF
42
43
CREATE TABLE IF NOT EXISTS "nyc_taxi"
43
- ("congestion_surcharge" REAL, "dolocationid" INTEGER, "extra" REAL, "fare_amount" REAL, "improvement_surcharge" REAL, "mta_tax" REAL, "passenger_count" INTEGER, "payment_type" INTEGER, "pickup_datetime" TIMESTAMP WITH TIME ZONE, "pulocationid" INTEGER, "ratecodeid" INTEGER, "store_and_fwd_flag" TEXT, "tip_amount" REAL, "tolls_amount" REAL, "total_amount" REAL, "trip_distance" REAL, "vendorid" INTEGER)
44
- WITH ("column_policy" = 'dynamic', "number_of_replicas" = '0', "refresh_interval" = 10000);
44
+ (
45
+ "congestion_surcharge" REAL,
46
+ "dolocationid" INTEGER,
47
+ "extra" REAL,
48
+ "fare_amount" REAL,
49
+ "improvement_surcharge" REAL,
50
+ "mta_tax" REAL,
51
+ "passenger_count" INTEGER,
52
+ "payment_type" INTEGER,
53
+ "pickup_datetime" TIMESTAMP WITH TIME ZONE,
54
+ "pulocationid" INTEGER,
55
+ "ratecodeid" INTEGER,
56
+ "store_and_fwd_flag" TEXT,
57
+ "tip_amount" REAL,
58
+ "tolls_amount" REAL,
59
+ "total_amount" REAL,
60
+ "trip_distance" REAL,
61
+ "vendorid" INTEGER
62
+ )
63
+ WITH ("number_of_replicas" = '0', "refresh_interval" = 1000);
45
64
46
65
COPY "nyc_taxi"
47
66
FROM 'https://s3.amazonaws.com/crate.sampledata/nyc.yellowcab/yc.2019.07.gz'
60
79
61
80
# 4. User notes
62
81
echo
63
- echo " The CrateDB database service has been started and populated with a subset of the NYC Yellowcab data into the table 'doc.nyc_taxi'."
64
- echo " The administration interface is available at http://localhost:4200."
65
- echo
66
- echo " If you are finished, you may want to shut down the database service using '${cratedb_stop} '."
67
- echo " Enjoy conducting your experiments."
68
- echo
82
+ cat << EOF
83
+ The CrateDB database service has been started and populated with a
84
+ subset of the NYC Yellowcab data into the table 'doc.nyc_taxi'.
85
+
86
+ The CrateDB administration interface is available at http://localhost:4200.
87
+
88
+ If you are finished, you may want to shut down and remove any remnants
89
+ of the database service container using '${cratedb_stop} '.
90
+
91
+ Enjoy conducting your experiments.
92
+
93
+ EOF
0 commit comments