Skip to content

Commit

Permalink
kafka 구축
Browse files Browse the repository at this point in the history
  • Loading branch information
goo-gy committed May 26, 2022
1 parent a1c5bf0 commit fb90c12
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,24 @@ DB_password=[]

---

## DB 설치 및 초기화
## 개발환경 Init

``` shell
npm run env:init
```

- MySQL
설치 및 Database 생성
- Kafka
- zookeeper
-


## DB Scheme 생성

- Docker 설치 후

```shell
npm run db:init
npm run db:migrate
```

Expand Down
26 changes: 25 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,28 @@ services:
ports:
- "${DB_PORT}:3306"
environment:
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}

zookeeper:
image: confluentinc/cp-zookeeper:7.0.0
hostname: zookeeper
container_name: letters_zookeeper
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000

broker:
image: confluentinc/cp-kafka:7.0.0
container_name: letters_broker
ports:
- "9092:9092"
depends_on:
- zookeeper
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_INTERNAL:PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092,PLAINTEXT_INTERNAL://broker:29092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"start": "nodemon",
"db:init": "docker-compose up -d --build",
"env:init": "docker-compose up -d --build",
"db:migrate": "babel-node migration.js up",
"db:rollback": "babel-node migration.js down",
"db:test" : "babel-node ./src/db/test.js"
Expand Down

0 comments on commit fb90c12

Please sign in to comment.