Skip to content

Commit 031070e

Browse files
authored
MemSQL 5.5.x
Ship it
1 parent e6782c6 commit 031070e

File tree

7 files changed

+50
-25
lines changed

7 files changed

+50
-25
lines changed

BUILD.md

-13
This file was deleted.

Dockerfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# https://github.com/memsql/memsql-docker-quickstart
55
#
66

7-
FROM debian:8.4
7+
FROM debian:8.6
88
MAINTAINER Carl Sverre <[email protected]>
99

1010
RUN apt-get update && \
@@ -34,8 +34,9 @@ RUN mkdir /memsql /memsql-ops
3434

3535
# download and install MemSQL Ops
3636
# then reduce size by symlinking objdir and lib from one install to the other
37-
COPY setup_ops.sh /tmp/setup_ops.sh
38-
RUN /tmp/setup_ops.sh
37+
COPY setup.sh /tmp/setup.sh
38+
ADD VERSIONS /tmp/VERSIONS
39+
RUN /tmp/setup.sh
3940

4041
# COPY helper scripts
4142
COPY memsql-shell /usr/local/bin/memsql-shell

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.PHONY: latest
2+
latest:
3+
docker build -t memsql/quickstart:latest -f Dockerfile .

README.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ docker pull memsql/quickstart
1414
1515
1616
# Verify your machine satisfies our minimum requirements
17-
docker run --rm --net=host memsql/quickstart check-system
17+
docker run --rm memsql/quickstart check-system
1818
1919
2020
# Spin up a MemSQL cluster on your machine
@@ -30,5 +30,15 @@ docker run --rm -it --link=memsql:memsql memsql/quickstart memsql-shell
3030
3131
3232
# Stop and remove the container
33-
docker stop memsql && docker rm -v memsql
33+
docker rm -fv memsql
34+
```
35+
36+
### Custom schema file at start
37+
38+
If you mount a SQL file to /schema.sql inside the container it will be loaded
39+
when the cluster is started. Example:
40+
41+
```
42+
echo "CREATE DATABASE test;" > schema.sql
43+
docker run -d -v $(PWD)/schema.sql:/schema.sql -p 3306:3306 -p 9000:9000 --name=memsql memsql/quickstart
3444
```

VERSIONS

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export OPS_VERSION=5.5.0
2+
export MEMSQL_VERSION=321074d63e5f6f4bb6229c1fce597993e720daae
3+

memsql-entrypoint.sh

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
#!/bin/bash
22
set -e
33

4-
if [ "$1" = "memsqld" ]; then
5-
# Start up the cluster
4+
if [[ "$1" = "memsqld" ]]; then
65
memsql-ops start
76
memsql-ops memsql-start --all
87
memsql-ops memsql-list
98

9+
# Check for a schema file at /schema.sql and load it
10+
if [[ -e /schema.sql ]]; then
11+
echo "Loading schema from /schema.sql"
12+
cat /schema.sql
13+
memsql < /schema.sql
14+
fi
15+
1016
# Tail the logs to keep the container alive
1117
exec tail -F /memsql/master/tracelogs/memsql.log /memsql/leaf/tracelogs/memsql.log
18+
else
19+
exec "$@"
1220
fi
13-
14-
exec "$@"
15-

setup_ops.sh setup.sh

+18-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
set -e
33
set -x
44

5-
VERSION_URL="http://versions.memsql.com/memsql-ops/5.1.0"
5+
# Expects this file to export $OPS_VERSION and $MEMSQL_VERSION
6+
source /tmp/VERSIONS
7+
8+
VERSION_URL="http://versions.memsql.com/memsql-ops/$OPS_VERSION"
69
MEMSQL_VOLUME_PATH="/memsql"
710
OPS_URL=$(curl -s "$VERSION_URL" | jq -r .tar)
811

@@ -20,16 +23,29 @@ mkdir /tmp/memsql-ops
2023
tar -xzf /tmp/memsql_ops.tar.gz -C /tmp/memsql-ops --strip-components 1
2124
/tmp/memsql-ops/install.sh \
2225
--host 127.0.0.1 \
23-
--simple-cluster \
26+
--no-cluster \
2427
--ops-datadir /memsql-ops \
2528
--memsql-installs-dir /memsql-ops/installs
2629

30+
DEPLOY_EXTRA_FLAGS=
31+
if [[ $MEMSQL_VERSION != "community" ]]; then
32+
DEPLOY_EXTRA_FLAGS="--version-hash $MEMSQL_VERSION"
33+
fi
34+
35+
memsql-ops memsql-deploy --role master --community-edition $DEPLOY_EXTRA_FLAGS
36+
memsql-ops memsql-deploy --role leaf --community-edition --port 3307 $DEPLOY_EXTRA_FLAGS
37+
2738
MASTER_ID=$(memsql-ops memsql-list --memsql-role=master -q)
2839
MASTER_PATH=$(memsql-ops memsql-path $MASTER_ID)
2940

3041
LEAF_ID=$(memsql-ops memsql-list --memsql-role=leaf -q)
3142
LEAF_PATH=$(memsql-ops memsql-path $LEAF_ID)
3243

44+
# We need to clear the maximum-memory setting in the leaf's memsql.cnf otherwise
45+
# when we move to another machine with a different amount of memory the memory
46+
# imbalance nag will show up
47+
memsql-ops memsql-update-config --key maximum_memory --delete $LEAF_ID
48+
3349
# symlink leaf's static directories to master
3450
for tgt in objdir lib; do
3551
rm -rf $LEAF_PATH/$tgt

0 commit comments

Comments
 (0)