MySQL 메타데이터 스토어
MySQL 메타데이터 스토어 (MySQL metadata store)
MySQL을 Druid의 메타데이터 스토어로 사용하거나, MySQL 데이터베이스에서 데이터를 인제스트할 수 있는 확장 기능이에요.
출처: 문서
본문
이 Apache Druid 확장 기능을 사용하려면 extensions load list에 mysql-metadata-storage를 포함하세요.
MySQL 확장 기능을 사용하면 MySQL을 메타데이터 스토어로 사용하거나 MySQL 데이터베이스에서 데이터를 인제스트할 수 있어요.
이 확장 기능은 Druid에 포함되지 않은 커넥터 라이브러리가 필요해요. 설치 지침은 Prerequisites를 참고하세요.
선행 조건 (Prerequisites)
MySQL 확장 기능을 사용하려면 다음 라이브러리 중 하나를 설치해야 해요:
- MySQL Connector/J
- MariaDB Connector/J
MySQL Connector/J 설치 (Install MySQL Connector/J)
MySQL 확장 기능은 Oracle의 MySQL JDBC 드라이버를 사용해요. 현재 버전의 Druid는 8.2.0 버전을 사용해요. 다른 버전은 이 확장 기능과 호환되지 않을 수 있어요.
다음 소스 중 하나에서 라이브러리를 다운로드할 수 있어요:
- MySQL 웹사이트: 이전 제품 버전에 접근하려면 archives 페이지를 방문하세요.
- Maven Central (직접 다운로드)
- 패키지 관리자. 예를 들어 Debian 기반 OS에서는 APT의
libmysql-java.
다운로드에는 mysql-connector-j-8.2.0.jar 같은 이름의 MySQL 커넥터 JAR 파일이 포함돼요. 이 파일을 배포 루트 디렉터리의 lib 폴더 안에 복사하거나 심볼릭 링크를 만드세요.
MariaDB Connector/J 설치 (Install MariaDB Connector/J)
이 확장 기능은 MariaDB 커넥터 jar도 지원해요. 현재 버전의 Druid는 2.7.3 버전을 사용해요. 다른 버전은 이 확장 기능과 호환되지 않을 수 있어요.
다음 소스 중 하나에서 라이브러리를 다운로드할 수 있어요:
- MariaDB 웹사이트: 이전 제품 버전에 접근하려면 Show All Files를 클릭하세요.
- Maven Central (직접 다운로드)
다운로드에는 maria-java-client-2.7.3.jar 같은 이름의 MariaDB 커넥터 JAR 파일이 포함돼요. 이 파일을 배포 루트 디렉터리의 lib 폴더 안에 복사하거나 심볼릭 링크를 만드세요.
MySQL 대신 MariaDB 커넥터 라이브러리를 사용하도록 mysql-metadata-storage 확장을 구성하려면 druid.metadata.mysql.driver.driverClassName=org.mariadb.jdbc.Driver를 설정하세요.
연결 문자열의 프로토콜은 MariaDB 클라이언트 라이브러리의 특정 버전에 따라 jdbc:mysql: 또는 jdbc:mariadb:예요. 연결 구성을 위한 매개변수에 대한 자세한 내용은 해당 커넥터 버전의 MariaDB 문서를 참고하세요.
MySQL 설정 (Set up MySQL)
대용량 메타데이터 테이블에 대한 스키마 변경이 필요한 업그레이드 문제를 피하려면 instant ADD COLUMN 의미를 지원하는 MySQL 버전을 고려하세요. 예를 들어 MySQL 8이에요.
MySQL 설치 (Install MySQL)
선호하는 패키지 관리자로 mysql을 설치하세요:
- Ubuntu/Debian에서 apt 사용:
apt-get install mysql-server - OS X에서 Homebrew 사용:
brew install mysql
또는 MySQL Community Server를 다운로드해 설치 지침을 따르세요.
이 확장 기능은 MariaDB 서버도 지원해요: https://mariadb.org/download/ . 아래 지침에서 필요한 곳에 MariaDB를 대체하세요.
druid 데이터베이스와 사용자 생성 (Create a druid database and user)
MySQL이 설치된 머신에서 MySQL에 연결하세요.
mysql -u root
mysql 프롬프트에 다음 스니펫을 붙여넣으세요:
-- create a druid database, make sure to use utf8mb4 as encoding
CREATE DATABASE druid DEFAULT CHARACTER SET utf8mb4;
-- create a druid user
CREATE USER 'druid'@'localhost' IDENTIFIED BY 'password';
-- grant the user all the permissions on the database we just created
GRANT ALL PRIVILEGES ON druid.* TO 'druid'@'localhost';
Druid 메타데이터 스토리지 확장 구성 (Configure your Druid metadata storage extension)
<host>를 데이터베이스의 위치(호스트 이름과 포트)로 바꿔 Druid 구성에 다음 매개변수를 추가하세요.
druid.extensions.loadList=["mysql-metadata-storage"]
druid.metadata.storage.type=mysql
druid.metadata.storage.connector.connectURI=jdbc:mysql://<host>/druid
druid.metadata.storage.connector.user=druid
druid.metadata.storage.connector.password=diurd
MariaDB 커넥터 라이브러리를 사용한다면 druid.metadata.mysql.driver.driverClassName=org.mariadb.jdbc.Driver를 설정하세요.
MySQL 연결 암호화 (Encrypt MySQL connections)
이 확장 기능은 MySQL 연결 암호화를 지원해요. TLS/SSL을 사용한 MySQL 연결 암호화에 대한 일반적인 자세한 내용은 이 가이드를 참고하세요.
구성 속성 (Configuration properties)
| Property | Description | Default | Required | | druid.metadata.mysql.ssl.useSSL | Enable SSL | false | no | | druid.metadata.mysql.ssl.clientCertificateKeyStoreUrl | The file path URL to the client certificate key store. | none | no | | druid.metadata.mysql.ssl.clientCertificateKeyStoreType | The type of the key store where the client certificate is stored. | none | no | | druid.metadata.mysql.ssl.clientCertificateKeyStorePassword | The Password Provider or String password for the client key store. | none | no | | druid.metadata.mysql.ssl.verifyServerCertificate | Enables server certificate verification. | false | no | | druid.metadata.mysql.ssl.trustCertificateKeyStoreUrl | The file path to the trusted root certificate key store. | Default trust store provided by MySQL | yes if verifyServerCertificate is set to true and a custom trust store is used | | druid.metadata.mysql.ssl.trustCertificateKeyStoreType | The type of the key store where trusted root certificates are stored. | JKS | yes if verifyServerCertificate is set to true and keystore type is not JKS | | druid.metadata.mysql.ssl.trustCertificateKeyStorePassword | The Password Provider or String password for the trust store. | none | yes if verifyServerCertificate is set to true and password is not null | | druid.metadata.mysql.ssl.enabledSSLCipherSuites | Overrides the existing cipher suites with these cipher suites. | none | no | | druid.metadata.mysql.ssl.enabledTLSProtocols | Overrides the TLS protocols with these protocols. | none | no |
MySQL 입력 소스 (MySQL input source)
MySQL 확장 기능은 MySQL 데이터베이스에서 Druid로 데이터를 인제스트하기 위한 SQL 입력 소스 구현을 제공해요. 입력 소스 매개변수에 대한 자세한 내용은 SQL input source를 참고하세요.
{
"type": "index_parallel",
"spec": {
"dataSchema": {
"dataSource": "some_datasource",
"dimensionsSpec": {
"dimensionExclusions": [],
"dimensions": [
"dim1",
"dim2",
"dim3"
]
},
"timestampSpec": {
"format": "auto",
"column": "ts"
},
"metricsSpec": [],
"granularitySpec": {
"type": "uniform",
"segmentGranularity": "DAY",
"queryGranularity": {
"type": "none"
},
"rollup": false,
"intervals": null
},
"transformSpec": {
"filter": null,
"transforms": []
}
},
"ioConfig": {
"type": "index_parallel",
"inputSource": {
"type": "sql",
"database": {
"type": "mysql",
"connectorConfig": {
"connectURI": "jdbc:mysql://some-rds-host.us-west-1.rds.amazonaws.com:3306/druid",
"user": "admin",
"password": "secret"
}
},
"sqls": [
"SELECT * FROM some_table"
]
},
"inputFormat": {
"type": "json"
}
},
"tuningConfig": {
"type": "index_parallel"
}
}
}