-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gms): add postgres & mariadb supports to GMS (#1742)
* feat(gms): add postgres & mariadb supports to GMS Also add corresponding docker-compose files * Update README.md
- Loading branch information
Showing
13 changed files
with
253 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
version: '3.5' | ||
services: | ||
datahub-gms: | ||
image: linkedin/datahub-gms:${DATAHUB_VERSION:-latest} | ||
build: | ||
context: ../../ | ||
dockerfile: docker/gms/Dockerfile | ||
hostname: datahub-gms | ||
container_name: datahub-gms | ||
ports: | ||
- "8080:8080" | ||
environment: | ||
- EBEAN_DATASOURCE_USERNAME=datahub | ||
- EBEAN_DATASOURCE_PASSWORD=datahub | ||
- EBEAN_DATASOURCE_HOST=mariadb:3306 | ||
- EBEAN_DATASOURCE_URL=jdbc:mariadb://mariadb:3306/datahub | ||
- EBEAN_DATASOURCE_DRIVER=org.mariadb.jdbc.Driver | ||
- KAFKA_BOOTSTRAP_SERVER=broker:29092 | ||
- KAFKA_SCHEMAREGISTRY_URL=http://schema-registry:8081 | ||
- ELASTICSEARCH_HOST=elasticsearch | ||
- ELASTICSEARCH_PORT=9200 | ||
- NEO4J_HOST=neo4j:7474 | ||
- NEO4J_URI=bolt://neo4j | ||
- NEO4J_USERNAME=neo4j | ||
- NEO4J_PASSWORD=datahub | ||
|
||
networks: | ||
default: | ||
name: datahub_network |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
version: '3.5' | ||
services: | ||
datahub-gms: | ||
image: linkedin/datahub-gms:${DATAHUB_VERSION:-latest} | ||
build: | ||
context: ../../ | ||
dockerfile: docker/gms/Dockerfile | ||
hostname: datahub-gms | ||
container_name: datahub-gms | ||
ports: | ||
- "8080:8080" | ||
environment: | ||
- EBEAN_DATASOURCE_USERNAME=datahub | ||
- EBEAN_DATASOURCE_PASSWORD=datahub | ||
- EBEAN_DATASOURCE_HOST=postgres:5432 | ||
- EBEAN_DATASOURCE_URL=jdbc:postgresql://postgres:5432/datahub | ||
- EBEAN_DATASOURCE_DRIVER=org.postgresql.Driver | ||
- KAFKA_BOOTSTRAP_SERVER=broker:29092 | ||
- KAFKA_SCHEMAREGISTRY_URL=http://schema-registry:8081 | ||
- ELASTICSEARCH_HOST=elasticsearch | ||
- ELASTICSEARCH_PORT=9200 | ||
- NEO4J_HOST=neo4j:7474 | ||
- NEO4J_URI=bolt://neo4j | ||
- NEO4J_USERNAME=neo4j | ||
- NEO4J_PASSWORD=datahub | ||
|
||
networks: | ||
default: | ||
name: datahub_network |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# MariaDB | ||
|
||
DataHub GMS can use MariaDB as an alternate storage backend. | ||
|
||
[Official MariaDB Docker image](https://hub.docker.com/_/mariadb) found in Docker Hub is used without | ||
any modification. | ||
|
||
## Run Docker container | ||
Below command will start the MariaDB container. | ||
``` | ||
cd docker/mariadb && docker-compose pull && docker-compose up | ||
``` | ||
|
||
An initialization script [init.sql](init.sql) is provided to container. This script initializes `metadata-aspect` table | ||
which is basically the Key-Value store of the DataHub GMS. | ||
|
||
To connect to MariaDB container, you can type below command: | ||
``` | ||
docker exec -it mariadb mysql -u datahub -pdatahub datahub | ||
``` | ||
|
||
## Container configuration | ||
### External Port | ||
If you need to configure default configurations for your container such as the exposed port, you will do that in | ||
`docker-compose.yml` file. Refer to this [link](https://docs.docker.com/compose/compose-file/#ports) to understand | ||
how to change your exposed port settings. | ||
``` | ||
ports: | ||
- '3306:3306' | ||
``` | ||
|
||
### Docker Network | ||
All Docker containers for DataHub are supposed to be on the same Docker network which is `datahub_network`. | ||
If you change this, you will need to change this for all other Docker containers as well. | ||
``` | ||
networks: | ||
default: | ||
name: datahub_network | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
version: '3.5' | ||
services: | ||
mysql: | ||
container_name: mariadb | ||
hostname: mariadb | ||
image: mariadb:10.5 | ||
restart: always | ||
environment: | ||
MYSQL_DATABASE: 'datahub' | ||
MYSQL_USER: 'datahub' | ||
MYSQL_PASSWORD: 'datahub' | ||
MYSQL_ROOT_PASSWORD: 'datahub' | ||
ports: | ||
- '3306:3306' | ||
volumes: | ||
- ./init.sql:/docker-entrypoint-initdb.d/init.sql | ||
|
||
networks: | ||
default: | ||
name: datahub_network |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-- create metadata aspect table | ||
create table metadata_aspect ( | ||
urn varchar(500) not null, | ||
aspect varchar(200) not null, | ||
version bigint(20) not null, | ||
metadata longtext not null, | ||
createdon datetime(6) not null, | ||
createdby varchar(255) not null, | ||
createdfor varchar(255), | ||
constraint pk_metadata_aspect primary key (urn,aspect,version) | ||
); | ||
|
||
-- create default records for datahub user | ||
insert into metadata_aspect (urn, aspect, version, metadata, createdon, createdby) values( | ||
'urn:li:corpuser:datahub', | ||
'com.linkedin.identity.CorpUserInfo', | ||
0, | ||
'{"displayName":"Data Hub","active":true,"fullName":"Data Hub","email":"datahub@linkedin.com"}', | ||
now(), | ||
'urn:li:principal:datahub' | ||
), ( | ||
'urn:li:corpuser:datahub', | ||
'com.linkedin.identity.CorpUserEditableInfo', | ||
0, | ||
'{"skills":[],"teams":[],"pictureLink":"https://raw.githubusercontent.com/linkedin/datahub/master/datahub-web/packages/data-portal/public/assets/images/default_avatar.png"}', | ||
now(), | ||
'urn:li:principal:datahub' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# MySQL | ||
|
||
DataHub GMS can use PostgreSQL as an alternate storage backend. | ||
|
||
[Official PostgreSQL Docker image](https://hub.docker.com/_/postgres) found in Docker Hub is used without | ||
any modification. | ||
|
||
## Run Docker container | ||
Below command will start the MySQL container. | ||
``` | ||
cd docker/postgres && docker-compose pull && docker-compose up | ||
``` | ||
|
||
An initialization script [init.sql](init.sql) is provided to container. This script initializes `metadata-aspect` table | ||
which is basically the Key-Value store of the DataHub GMS. | ||
|
||
To connect to PostgreSQL container, you can type below command: | ||
``` | ||
docker exec -it postgres psql -U datahub | ||
``` | ||
|
||
## Container configuration | ||
### External Port | ||
If you need to configure default configurations for your container such as the exposed port, you will do that in | ||
`docker-compose.yml` file. Refer to this [link](https://docs.docker.com/compose/compose-file/#ports) to understand | ||
how to change your exposed port settings. | ||
``` | ||
ports: | ||
- '5432:5432' | ||
``` | ||
|
||
### Docker Network | ||
All Docker containers for DataHub are supposed to be on the same Docker network which is `datahub_network`. | ||
If you change this, you will need to change this for all other Docker containers as well. | ||
``` | ||
networks: | ||
default: | ||
name: datahub_network | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
version: '3.5' | ||
services: | ||
postgres: | ||
container_name: postgres | ||
hostname: postgres | ||
image: postgres:12.3 | ||
restart: always | ||
environment: | ||
POSTGRES_USER: datahub | ||
POSTGRES_PASSWORD: datahub | ||
ports: | ||
- '5432:5432' | ||
volumes: | ||
- ./init.sql:/docker-entrypoint-initdb.d/init.sql | ||
|
||
networks: | ||
default: | ||
name: datahub_network |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-- create metadata aspect table | ||
create table metadata_aspect ( | ||
urn varchar(500) not null, | ||
aspect varchar(200) not null, | ||
version bigint not null, | ||
metadata text not null, | ||
createdon timestamp not null, | ||
createdby varchar(255) not null, | ||
createdfor varchar(255), | ||
constraint pk_metadata_aspect primary key (urn,aspect,version) | ||
); | ||
|
||
-- create default records for datahub user | ||
insert into metadata_aspect (urn, aspect, version, metadata, createdon, createdby) values( | ||
'urn:li:corpuser:datahub', | ||
'com.linkedin.identity.CorpUserInfo', | ||
0, | ||
'{"displayName":"Data Hub","active":true,"fullName":"Data Hub","email":"datahub@linkedin.com"}', | ||
now(), | ||
'urn:li:principal:datahub' | ||
), ( | ||
'urn:li:corpuser:datahub', | ||
'com.linkedin.identity.CorpUserEditableInfo', | ||
0, | ||
'{"skills":[],"teams":[],"pictureLink":"https://raw.githubusercontent.com/linkedin/datahub/master/datahub-web/packages/data-portal/public/assets/images/default_avatar.png"}', | ||
now(), | ||
'urn:li:principal:datahub' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters