Skip to content

Commit 7ed456b

Browse files
committed
working on genie
1 parent 4569324 commit 7ed456b

File tree

7 files changed

+186
-0
lines changed

7 files changed

+186
-0
lines changed

example-netflix-genie/README.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Basic CockroachDB Cluster with HAProxy
2+
Simple 3 node CockroachDB cluster with HAProxy acting as load balancer
3+
4+
## Services
5+
* `crdb-0` - CockroachDB node
6+
* `crdb-1` - CockroachDB node
7+
* `crdb-2` - CockroachDB node
8+
* `lb` - HAProxy acting as load balancer
9+
10+
## Getting started
11+
1) run `docker-compose up`
12+
2) visit the CockroachDB UI @ http://localhost:8080
13+
3) visit the HAProxy UI @ http://localhost:8081
14+
4) have fun!
15+
16+
## Helpful Commands
17+
18+
### Execute SQL
19+
Use the following to execute arbitrary SQL on the CockroachDB cluster. The following creates a database called `test`.
20+
```bash
21+
docker-compose exec crdb-0 /cockroach/cockroach sql --insecure --execute="CREATE DATABASE test;"
22+
```
23+
24+
### Initialize and Run the TPC-C Workload
25+
Use the following commands to initialize and run the `tpcc` sample `workload`. For more details see [this](https://www.cockroachlabs.com/docs/stable/cockroach-workload.html#run-the-tpcc-workload).
26+
27+
to initialize...
28+
```bash
29+
docker-compose exec crdb-0 /cockroach/cockroach workload init tpcc "postgresql://root@localhost:26257?sslmode=disable"
30+
```
31+
32+
to run for `10m`...
33+
```bash
34+
docker-compose exec crdb-0 /cockroach/cockroach workload run tpcc --duration=10m "postgresql://root@localhost:26257?sslmode=disable"
35+
```
36+
37+
### Open Interactive Shells
38+
```bash
39+
docker-compose exec genie /bin/bash
40+
docker-compose exec crdb-1 /bin/bash
41+
docker-compose exec crdb-2 /bin/bash
42+
docker-compose exec lb /bin/sh
43+
```
44+
45+
### Stop Individual nodes
46+
```bash
47+
docker-compose stop crdb-0
48+
docker-compose stop crdb-1
49+
docker-compose stop crdb-2
50+
```
+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
version: "2"
2+
3+
services:
4+
crdb:
5+
container_name: crdb
6+
hostname: crdb
7+
image: cockroachdb/cockroach:latest
8+
command: start-single-node --cluster-name=example-single-node --logtostderr=WARNING --log-file-verbosity=WARNING --insecure
9+
ports:
10+
- "26257:26257"
11+
- "8081:8080"
12+
13+
crdb-init:
14+
container_name: crdb-init
15+
hostname: crdb-init
16+
image: timveil/cockroachdb-remote-client:latest
17+
environment:
18+
- COCKROACH_HOST=crdb:26257
19+
- COCKROACH_INSECURE=true
20+
- DATABASE_NAME=genie
21+
depends_on:
22+
- crdb
23+
24+
genie:
25+
build: genie
26+
ports:
27+
- "8080:8080"
28+
depends_on:
29+
- genie-hadoop-prod
30+
- genie-hadoop-test
31+
- genie-apache
32+
- crdb
33+
tty: true
34+
container_name: genie_demo_app_3.3.20
35+
36+
genie-apache:
37+
image: netflixoss/genie-demo-apache:3.3.20
38+
tty: true
39+
container_name: genie_demo_apache_3.3.20
40+
41+
genie-client:
42+
image: netflixoss/genie-demo-client:3.3.20
43+
depends_on:
44+
- genie
45+
tty: true
46+
container_name: genie_demo_client_3.3.20
47+
48+
genie-hadoop-prod:
49+
image: sequenceiq/hadoop-docker:2.7.1
50+
command: /bin/bash -c "/usr/local/hadoop/sbin/mr-jobhistory-daemon.sh start historyserver && /etc/bootstrap.sh -bash"
51+
ports:
52+
- "19888:19888"
53+
- "50070:50070"
54+
- "50075:50075"
55+
- "8088:8088"
56+
tty: true
57+
container_name: genie_demo_hadoop_prod_3.3.20
58+
59+
genie-hadoop-test:
60+
image: sequenceiq/hadoop-docker:2.7.1
61+
command: /bin/bash -c "/usr/local/hadoop/sbin/mr-jobhistory-daemon.sh start historyserver && /etc/bootstrap.sh -bash"
62+
ports:
63+
- "19889:19888"
64+
- "50071:50070"
65+
- "50076:50075"
66+
- "8089:8088"
67+
tty: true
68+
container_name: genie_demo_hadoop_test_3.3.20

example-netflix-genie/down.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
docker-compose down --remove-orphans --volumes
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM netflixoss/genie-app:3.3.20
2+
3+
LABEL maintainer="[email protected]"
4+
5+
ARG POSTGRESQL_JDBC_VERSION=42.2.14
6+
7+
COPY application-crdb.yml /usr/local/bin/application-crdb.yml
8+
9+
RUN apt-get update && apt-get install -y --no-install-recommends curl
10+
11+
RUN mkdir /home/.genie/lib
12+
13+
RUN curl -fSL https://jdbc.postgresql.org/download/postgresql-$POSTGRESQL_JDBC_VERSION.jar -o /home/.genie/lib/postgresql-jdbc.jar
14+
15+
EXPOSE 8080
16+
17+
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/usr/local/bin/genie.jar", "--spring.profiles.active=crdb"]
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
##
2+
#
3+
# Copyright 2016 Netflix, Inc.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
##
18+
19+
flyway:
20+
locations: db/migration/postgresql
21+
22+
spring:
23+
datasource:
24+
platform: postgresql
25+
url: jdbc:postgresql://crdb:26257/genie
26+
username: root
27+
password:
28+
tomcat:
29+
validation-query: select 0;
30+
31+
jpa:
32+
properties:
33+
hibernate:
34+
dialect: org.hibernate.dialect.PostgreSQL95Dialect
35+
hibernate:
36+
ddl-auto: validate
37+
38+
profiles:
39+
active: crdb
40+

example-netflix-genie/prune.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
docker system prune -a -f --volumes

example-netflix-genie/up.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
docker-compose build --no-cache
4+
docker-compose up -d

0 commit comments

Comments
 (0)