Skip to content

Instantly share code, notes, and snippets.

View joeywhelan's full-sized avatar

Joey Whelan joeywhelan

View GitHub Profile
helm repo add elastic https://helm.elastic.co
helm repo update elastic
helm install elastic-operator elastic/eck-operator -n elastic-system --create-namespace
kind create cluster
docker run -d --rm --name cloud-provider-kind --network kind \
-v /var/run/docker.sock:/var/run/docker.sock registry.k8s.io/cloud-provider-kind/cloud-controller-manager:v0.6.0
$ curl -s -X POST -H "Content-Type: application/json" -d @pinot/s4.json http://localhost:8099/query/sql
| jq '.resultTable'
{
"dataSchema": {
"columnNames": [
"CO_Total"
],
"columnDataTypes": [
"LONG"
]
$ redis-cli -p 12000 -3 FT.SEARCH locationidx '@point_wkt:[WITHIN $Colorado]' PARAMS 2 Colorado 'POLYGON((-109.0448 37.0004,-102.0424 36.9949,-102.0534 41.0006,-109.0489 40.9996,-109.0448 37.0004,-109.0448 37.0004))' LIMIT 0 0 DIALECT 2
1# attributes => (empty array)
2# warning => (empty array)
3# total_results => (integer) 12500
4# format => STRING
5# results => (empty array)
echo -e "\n*** Build Pinot Schema and Table ***"
docker exec -it pinot-controller /opt/pinot/bin/pinot-admin.sh AddTable -tableConfigFile /tmp/pinot/config/table.json -schemaFile /tmp/pinot/config/schema.json -controllerHost localhost -controllerPort 9000 -exec > /dev/null 2>&1
sleep 1
echo -e "\n*** Ingest Data to Pinot ***"
docker exec -it pinot-controller /opt/pinot/bin/pinot-admin.sh LaunchDataIngestionJob -jobSpecFile /tmp/pinot/config/job-spec.yaml > /dev/null 2>&1
pinot-controller:
image: apachepinot/pinot:latest
command: "StartController -zkAddress pinot-zookeeper:2181"
container_name: "pinot-controller"
restart: unless-stopped
ports:
- "9000:9000"
environment:
JAVA_OPTS: "-Dplugins.dir=/opt/pinot/plugins -Xms1G -Xmx4G -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -Xloggc:gc-pinot-controller.log"
depends_on:
def worker(ndocs):
global fake
result = []
for _ in range(ndocs):
uuid = str(uuid4())
coords = fake.local_latlng(country_code="US", coords_only=True)
lat = round(float(coords[0]) + random.uniform(-1, 1), 5) # faker local_latlng generates duplicates. this is a workaround
lng = round(float(coords[1]) + random.uniform(-1, 1), 5)
point_lnglat = f'{lng} {lat}'
@joeywhelan
joeywhelan / redis-bash.sh
Last active March 2, 2025 20:22
redis-bash.sh
echo -e "\n*** Build Redis Cluster ***"
docker exec -it re1 /opt/redislabs/bin/rladmin cluster create name cluster.local username redis@redis.com password redis
docker exec -it re2 /opt/redislabs/bin/rladmin cluster join nodes 192.168.20.2 username redis@redis.com password redis
docker exec -it re3 /opt/redislabs/bin/rladmin cluster join nodes 192.168.20.2 username redis@redis.com password redis
sleep 1
echo -e "\n*** Build Target Redis DB ***"
curl -s -o /dev/null -k -u "redis@redis.com:redis" https://localhost:9443/v1/bdbs -H "Content-Type:application/json" -d @$PWD/redis/redb.json
echo -e "\n*** Create Redis Index ***"
re1:
image: redislabs/redis:latest
container_name: re1
restart: unless-stopped
tty: true
cap_add:
- sys_resource
ports:
- 12000:12000
- 8443:8443
@joeywhelan
joeywhelan / micro.sh
Created December 31, 2024 16:31
Deploy Microservices
echo -e "\n*** Deploy Microservices ***"
kubectl apply -f $PWD/ms1/ms1.yaml
kubectl apply -f $PWD/ms2/ms2.yaml
kubectl rollout status deployment/ms1-app
kubectl rollout status deployment/ms2-app