-
Notifications
You must be signed in to change notification settings - Fork 74
feat: adding hive support #776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
829c712
f1b6d03
9d81ad3
3890817
24429f3
bb060d9
392a00a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "alice": { | ||
| "UserName": "alice", | ||
| "Password": "some_password" | ||
| }, | ||
| "bob": { | ||
| "UserName": "bob", | ||
| "Password": "another_password" | ||
| }, | ||
| "root": { | ||
| "UserName": "root", | ||
| "Password": "root" | ||
| } | ||
| } | ||
|
Comment on lines
+1
to
+14
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoding default credentials, even for examples, poses a security risk as this pattern might be copied into production environments. It's recommended to use placeholder values that are clearly not real passwords and instruct the user to replace them, or to read them from a configuration source that is not checked into version control. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| import os | ||
| import sys | ||
| import glob | ||
|
|
||
| # Configuration | ||
| WORK_DIR = os.getcwd() | ||
| if not WORK_DIR.endswith("examples/scdb-tutorial"): | ||
| print("Error: Please run this script from 'examples/scdb-tutorial' directory") | ||
| sys.exit(1) | ||
|
|
||
| # User input for MySQL password | ||
| mysql_password = input("Please enter your local MySQL root password: ").strip() | ||
| if not mysql_password: | ||
| print("Error: Password cannot be empty") | ||
| sys.exit(1) | ||
|
|
||
| # Paths to config files | ||
| alice_conf = "engine/alice/conf/gflags.conf" | ||
| bob_conf = "engine/bob/conf/gflags.conf" | ||
| scdb_conf = "scdb/conf/config.yml" | ||
| scdb_host = "scdb/conf/config.yml" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| def update_file(filepath, replacements): | ||
| with open(filepath, 'r') as f: | ||
| content = f.read() | ||
|
|
||
| for old, new in replacements.items(): | ||
| content = content.replace(old, new) | ||
|
|
||
| with open(filepath, 'w') as f: | ||
| f.write(content) | ||
| print(f"Updated {filepath}") | ||
|
Comment on lines
+23
to
+32
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| # 1. Update Alice Config | ||
| # We need to read from current file which might have random password from setup.sh | ||
| # But it's easier to read the file and replace the whole connection string regex, | ||
| # or just simpler: re-read .template if available? | ||
| # Let's try to be robust and read the template if exists, else read the file. | ||
| # However, setup.sh modifies files in place if they don't end in .template (it generates them from .template) | ||
| # So we can re-generate from .template | ||
|
|
||
| def process_template(template_path, output_path, replacements): | ||
| if not os.path.exists(template_path): | ||
| print(f"Warning: Template {template_path} not found, skipping.") | ||
| return | ||
| with open(template_path, 'r') as f: | ||
| content = f.read() | ||
|
|
||
| for old, new in replacements.items(): | ||
| content = content.replace(old, new) | ||
|
|
||
| with open(output_path, 'w') as f: | ||
| f.write(content) | ||
| print(f"Generated {output_path} from template") | ||
|
|
||
| # Replacements for Alice | ||
| alice_replacements = { | ||
| "__MYSQL_ROOT_PASSWD__": mysql_password, | ||
| "/home/admin/engine/conf": f"{WORK_DIR}/engine/alice/conf", | ||
| "host=mysql": "host=127.0.0.1", | ||
| # Fix setup.sh's randomness if we are running on top of it | ||
| # But since we use template, we don't care about previous random password | ||
| } | ||
| process_template("engine/alice/conf/gflags.conf.template", alice_conf, alice_replacements) | ||
|
|
||
| # Replacements for Bob | ||
| bob_replacements = { | ||
| "__MYSQL_ROOT_PASSWD__": mysql_password, | ||
| "/home/admin/engine/conf": f"{WORK_DIR}/engine/bob/conf", | ||
| "host=mysql": "host=127.0.0.1", | ||
| "--listen_port=8003": "--listen_port=8004", # Change Port! | ||
| } | ||
| process_template("engine/bob/conf/gflags.conf.template", bob_conf, bob_replacements) | ||
|
|
||
| # Replacements for SCDB | ||
| scdb_replacements = { | ||
| "__MYSQL_ROOT_PASSWD__": mysql_password, | ||
| "mysql:3306": "127.0.0.1:3306", | ||
| } | ||
| process_template("scdb/conf/config.yml.template", scdb_conf, scdb_replacements) | ||
|
|
||
| print("\nConfiguration files updated successfully!") | ||
| print(f"Alice DB Port: 8003 (default)") | ||
| print(f"Bob DB Port: 8004 (modified)") | ||
| print(f"SCDB Port: 8080 (default)") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --listen_port=8003 | ||
| --datasource_router=embed | ||
| --enable_driver_authorization=false | ||
| --server_enable_ssl=false | ||
| --driver_enable_ssl_as_client=false | ||
| --peer_engine_enable_ssl_as_client=false | ||
| # Hive configuration using Arrow Flight SQL protocol | ||
| # Connection string format: grpc+tcp://<host>:<port> or grpc+tcp://<host>:<port>@<user>:<password> | ||
| # Note: Requires Arrow Flight SQL server running (e.g., Hive with Arrow Flight support, Spark Thrift Server with Arrow, etc.) | ||
| --embed_router_conf={"datasources":[{"id":"ds001","name":"hive db","kind":"HIVE","connection_str":"grpc://localhost:8815"}],"rules":[{"db":"*","table":"*","datasource_id":"ds001"}]} | ||
| # Arrow Flight SQL TLS configuration (optional) | ||
| --arrow_client_disable_server_verification=true | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Disabling server verification with |
||
| # --arrow_cert_pem_path=/path/to/ca.pem | ||
| # --arrow_client_key_pem_path=/path/to/client-key.pem | ||
| # --arrow_client_cert_pem_path=/path/to/client-cert.pem | ||
| # party authentication flags (disabled for testing) | ||
| --enable_self_auth=false | ||
| --enable_peer_auth=false | ||
| # --private_key_pem_path=./examples/scdb-tutorial/engine/alice/conf/ed25519key.pem | ||
| # --authorized_profile_path=./examples/scdb-tutorial/engine/alice/conf/authorized_profile.json | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --listen_port=8004 | ||
| --datasource_router=embed | ||
| --enable_driver_authorization=false | ||
| --server_enable_ssl=false | ||
| --driver_enable_ssl_as_client=false | ||
| --peer_engine_enable_ssl_as_client=false | ||
| # Hive configuration using Arrow Flight SQL protocol | ||
| # Connection string format: grpc+tcp://<host>:<port> or grpc+tcp://<host>:<port>@<user>:<password> | ||
| # Note: Requires Arrow Flight SQL server running (e.g., Hive with Arrow Flight support, Spark Thrift Server with Arrow, etc.) | ||
| --embed_router_conf={"datasources":[{"id":"ds001","name":"hive db","kind":"HIVE","connection_str":"grpc://localhost:8816"}],"rules":[{"db":"*","table":"*","datasource_id":"ds001"}]} | ||
| # Arrow Flight SQL TLS configuration (optional) | ||
| --arrow_client_disable_server_verification=true | ||
| # --arrow_cert_pem_path=/path/to/ca.pem | ||
| # --arrow_client_key_pem_path=/path/to/client-key.pem | ||
| # --arrow_client_cert_pem_path=/path/to/client-cert.pem | ||
| # party authentication flags (disabled for testing) | ||
| --enable_self_auth=false | ||
| --enable_peer_auth=false | ||
| # --private_key_pem_path=./examples/scdb-tutorial/engine/bob/conf/ed25519key.pem | ||
| # --authorized_profile_path=./examples/scdb-tutorial/engine/bob/conf/authorized_profile.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不修改,在配置文件里 kind 填 ARROWSQL 也是能运行的