Skip to content

Instantly share code, notes, and snippets.

View antongorshkov's full-sized avatar

Anton Gorshkov antongorshkov

View GitHub Profile
@antongorshkov
antongorshkov / wikistats_downloader
Created April 10, 2016 03:20
Wikimedia Pagecounts Downloader
#!/bin/bash
i="1"
while [ $i -lt 5 ]
do
url="https://dumps.wikimedia.org/other/pagecounts-raw/2016/2016-0$i/md5sums.txt"
echo $url
wget -q $url
cat md5sums.txt | grep pagecounts | cut -d" " -f3 > md5names.txt

Send a file to Kafka

while true; do bin/kafka-console-producer.sh --broker-list $KAFKA --topic test2 < simple.json > k.out; done

Pick a random file and send to Kafka

while true; do bin/kafka-console-producer.sh --broker-list $KAFKA --topic test2 < "$(ls *100.json | shuf | head -1)" > k.out; done
- xcode-select --install
- /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH"
- brew install coreutils
- sort -R
bin/kafka-topics.sh --zookeeper $KAFKAZK --describe --topic simple1
bin/kafka-topics.sh --zookeeper $KAFKAZK --alter --topic simple1 --config delete.retention.ms=5000
bin/kafka-topics.sh --zookeeper $KAFKAZK --alter --topic simple1 --config retention.ms=10000
bin/kafka-console-consumer.sh --zookeeper $KAFKAZK --topic simple1 --from-beginning
wget http://www-us.apache.org/dist/kafka/0.8.2.2/kafka_2.9.1-0.8.2.2.tgz
tar -xvf kafka_2.9.1-0.8.2.2.tgz
OR
Start here:
http://docs.memsql.com/4.1/setup/docker/
create database test;
use test;
CREATE TABLE test_table (id BIGINT PRIMARY KEY AUTO_INCREMENT, c INT);
INSERT INTO test_table (c) VALUES (1);
1. Install ZD(http://docs.zoomdata.com/docker-install)
2. Install MemSQL(http://docs.memsql.com/4.1/setup/docker/)
3. In docker shell:
- docker run -d -p 3306:3306 -p 9000:9000 --name memsql memsql/quickstart
- docker run --rm -it --link=memsql:memsql memsql/quickstart memsql-shell
4. Install DbVisualizer (https://www.dbvis.com/download/)
5. docker stop default
6. open VirtualBox, give at least 8192MB RAM + 4 Cores under processor
7. ZD, login as Supervisor, click advanced, enable MemSQL
8. ZD, connection: jdbc:mysql://192.168.99.100:3306/test