<commit_before>## memsql-spark-connector demo

This is Dockerfile which uses the upstream [Zeppelin Image](https://hub.docker.com/r/apache/zeppelin/) as it's base
and has two notebooks with examples of memsql-spark-connector.

To run this docker with [MemSQL CIAB](https://hub.docker.com/r/memsql/cluster-in-a-box) follow the instructions

* Create a docker network to be able to connect zeppelin and memsql-ciab
```
docker network create zeppelin-ciab-network
```

* Pull memsql-ciab docker image
```
docker pull memsql/cluster-in-a-box
```

*  Run and start memsql-ciab docker container

```
docker run -i --init \
--name memsql-ciab \
-e LICENSE_KEY=[INPUT_YOUR_LICENSE_KEY] \
-p 3306:3306 -p 8080:8080 \
--net=zeppelin-ciab-network \
memsql/cluster-in-a-box
```
```
docker start memsql-ciab
```

* Build zeppelin docker image in `memsql-spark-connector/demo` folder
```
docker build -t zeppelin .
```

* Run zeppelin docker container
```
docker run -i --init \
--name zeppelin \
-p 8082:8082 \
--net=zeppelin-ciab-network \
-v $PWD/notebook:/zeppelin/notebook/memsql \
zeppelin
```

* open [zeppelin](http://localhost:8082/next) in your browser and try
[scala](http://localhost:8082/next/#/notebook/2F8XQUKFG),
[pyspark](http://localhost:8082/next/#/notebook/2F6Y3APTX)
and [spark sql](http://localhost:8082/next/#/notebook/2F7PZ81H6) notebooks

For setting up more powerful MemSQL trial cluster use [Helios](https://www.memsql.com/helios/)<commit_msg>Improvements to Demo instructions<commit_after>## memsql-spark-connector demo

This is Dockerfile which uses the upstream [Zeppelin Image](https://hub.docker.com/r/apache/zeppelin/) as it's base
and has two notebooks with examples of memsql-spark-connector.

To run this docker with [MemSQL CIAB](https://hub.docker.com/r/memsql/cluster-in-a-box) follow the instructions

* Create a docker network to be able to connect zeppelin and memsql-ciab
```
docker network create zeppelin-ciab-network
```

* Pull memsql-ciab docker image
```
docker pull memsql/cluster-in-a-box
```

* Run and start the MemSQL Cluster in a Box docker container

```
docker run -i --init \
--name memsql-ciab-for-zeppelin \
-e LICENSE_KEY=[INPUT_YOUR_LICENSE_KEY] \
-p 3306:3306 -p 8080:8080 \
--net=zeppelin-ciab-network \
memsql/cluster-in-a-box
```
```
docker start memsql-ciab-for-zeppelin
```
> :note: in this step you can hit a port collision error
>
> ```
> docker: Error response from daemon: driver failed programming external connectivity on endpoint memsql-ciab-for-zeppelin
> (38b0df3496f1ec83f120242a53a7023d8a0b74db67f5e487fb23641983c67a76):
> Bind for 0.0.0.0:8080 failed: port is already allocated.
> ERRO[0000] error waiting for container: context canceled
> ```
>
> If it happened then remove the container
>
>`docker rm memsql-ciab-for-zeppelin`
>
> and run the first command with other ports `-p {new_port1}:3306 -p {new_port2}:8080`

* Build zeppelin docker image in `memsql-spark-connector/demo` folder

> :note: For this step you should be in `3.0.0-rc` branch.
> If you already cloned memsql-spark-connector git repository you can execute `git checkout 3.0.0-rc`.
> Otherwise you can clone this branch `git clone -b 3.0.0-rc https://github.com/memsql/memsql-spark-connector.git`

```
docker build -t zeppelin .
```

* Run zeppelin docker container
```
docker run -i --init \
--name zeppelin \
-p 8082:8082 \
--net=zeppelin-ciab-network \
-v $PWD/notebook:/zeppelin/notebook/memsql \
zeppelin
```

> :note: in this step you can hit a port collision error
>
> ```
> docker: Error response from daemon: driver failed programming external connectivity on endpoint zeppelin
> (38b0df3496f1ec83f120242a53a7023d8a0b74db67f5e487fb23641983c67a76):
> Bind for 0.0.0.0:8082 failed: port is already allocated.
> ERRO[0000] error waiting for container: context canceled
> ```
>
> If it happened then remove the container
>
>`docker rm zeppelin`
>
> and run this command with other port `-p {new_port}:8082`


* open [zeppelin](http://localhost:8082/next) in your browser and try
[scala](http://localhost:8082/next/#/notebook/2F8XQUKFG),
[pyspark](http://localhost:8082/next/#/notebook/2F6Y3APTX)
and [spark sql](http://localhost:8082/next/#/notebook/2F7PZ81H6) notebooks

For setting up more powerful MemSQL trial cluster use [Helios](https://www.memsql.com/helios/)
{'fraction_non_alphanumeric': 0.12885999535639656, 'fraction_numerical': 0.054562340376131876, 'mean_word_length': 4.4393939393939394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 34, 'https://': 7, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2679038', 'n_tokens_mistral': 1709, 'n_tokens_neox': 1513, 'n_words': 420}