Skip to content

Commit

Permalink
fix: adjust query configs for storage&users (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc authored Nov 21, 2022
1 parent 0bdeb14 commit 946865b
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 71 deletions.
4 changes: 2 additions & 2 deletions charts/databend-meta/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.6
version: 0.3.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v0.8.114-nightly"
appVersion: "v0.8.122-nightly"

dependencies:
- name: common
Expand Down
34 changes: 20 additions & 14 deletions charts/databend-meta/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,33 @@ spec:
0)
echo "initialize leader node";
/databend-meta --id ${ID} \
--log-stderr-on \
--log-stderr-level ERROR \
--log-file-level INFO \
--log-file-dir "{{ .Values.config.logDir }}" \
--max-applied-log-to-keep 102400 \
--raft-dir "{{ .Values.config.raft.dir }}" \
--admin-api-address ${POD_IP}:28002 \
--grpc-api-address ${POD_IP}:9191 \
--raft-api-port 28004 \
--raft-listen-host ${POD_IP} \
--raft-advertise-host ${POD_NAME}.{{ $fullName }}.${POD_NAMESPACE}.svc.cluster.local \
--config-id ${ID} \
--single
;;
*)
echo "initialize follower node";
/databend-meta --id ${ID} \
--log-stderr-on \
--log-stderr-level ERROR \
--log-file-level INFO \
--log-file-dir "{{ .Values.config.logDir }}" \
--max-applied-log-to-keep 102400 \
--raft-dir "{{ .Values.config.raft.dir }}" \
--admin-api-address ${POD_IP}:28002 \
--grpc-api-address ${POD_IP}:9191 \
--raft-api-port 28004 \
--raft-listen-host ${POD_IP} \
--raft-advertise-host ${POD_NAME}.{{ $fullName }}.${POD_NAMESPACE}.svc.cluster.local \
--config-id ${ID} \
--join ${NAME}-0.{{ $fullName }}:28004
Expand Down Expand Up @@ -98,20 +118,6 @@ spec:
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: METASRV_LOG_DIR
value: {{ .Values.config.logDir }}
- name: METASRV_LOG_LEVEL
value: {{ .Values.config.logLevel }}
- name: ADMIN_API_ADDRESS
value: 0.0.0.0:28002
- name: METASRV_GRPC_API_ADDRESS
value: 0.0.0.0:9191
- name: KVSRV_RAFT_DIR
value: {{ .Values.config.raft.dir }}
- name: KVSRV_LISTEN_HOST
value: 0.0.0.0
- name: KVSRV_API_PORT
value: "28004"
volumeMounts:
{{- if .Values.persistence.enabled }}
- name: data
Expand Down
4 changes: 2 additions & 2 deletions charts/databend-query/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.2.6
version: 0.3.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v0.8.114-nightly"
appVersion: "v0.8.122-nightly"

dependencies:
- name: minio
Expand Down
115 changes: 76 additions & 39 deletions charts/databend-query/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,87 @@ data:
config.toml: |-
# databend query config
[query]
max_active_sessions = {{ .Values.config.query.maxActiveSessions | default 256 }}
wait_timeout_mills = {{ .Values.config.query.waitTimeoutMills | default 5000 }}
max_active_sessions = {{ .Values.config.query.maxActiveSessions | default 256 }}
wait_timeout_mills = {{ .Values.config.query.waitTimeoutMills | default 5000 }}
tenant_id = {{ .Values.config.query.tenantId | quote }}
cluster_id = {{ .Values.config.query.clusterId | quote }}
tenant_id = {{ .Values.config.query.tenantId | default .Release.Name | quote }}
cluster_id = {{ .Values.config.query.clusterId | quote }}
table_cache_enabled = {{ .Values.config.query.tableCacheEnabled }}
{{- if .Values.config.query.tableCacheEnabled }}
table_memory_cache_mb_size = {{ .Values.config.query.tableMemoryCacheMbSize | default 1024 }}
table_disk_cache_root = {{ .Values.config.query.tableDiskCacheRoot | quote }}
table_disk_cache_mb_size = {{ .Values.config.query.tableDiskCacheMbSize }}
{{- end }}
management_mode = {{ .Values.config.query.managementMode }}
jwt_key_file = {{ .Values.config.query.jwtKeyFile | quote }}
table_cache_enabled = {{ .Values.config.query.tableCacheEnabled }}
{{- if .Values.config.query.tableCacheEnabled }}
table_memory_cache_mb_size = {{ .Values.config.query.tableMemoryCacheMbSize | default 1024 }}
table_disk_cache_root = {{ .Values.config.query.tableDiskCacheRoot | quote }}
table_disk_cache_mb_size = {{ .Values.config.query.tableDiskCacheMbSize }}
{{- end }}
management_mode = {{ .Values.config.query.managementMode }}
jwt_key_file = {{ .Values.config.query.jwtKeyFile | quote }}
{{- if .Values.config.query.users }}
{{- range .Values.config.query.users }}
[[query.users]]
name = {{ .name | quote }}
auth_type = {{ .authType | quote }}
{{- if eq .authType "sha256_password"}}
auth_string = {{ .authString | quote }}
{{- else if eq .authType "double_sha1_password"}}
auth_string = {{ .authString | quote }}
{{- end }}
{{- end }}
{{- end }}
[log]
log_level = {{ .Values.config.log.level | default "ERROR" | quote }}
log_dir = {{ .Values.config.log.dir | default "/var/log/query" | quote }}
query_enabled = {{ .Values.config.log.queryEnabled }}
[log.file]
on = {{ .Values.config.log.file.enabled }}
level = {{ .Values.config.log.file.level | default "INFO" | quote }}
dir = "/var/log/databend"
[log.stderr]
on = {{ .Values.config.log.stderr.enabled }}
level = {{ .Values.config.log.stderr.level | default "WARN" | quote }}
[meta]
meta_embedded_dir = {{ .Values.config.meta.embeddedDir | quote }}
meta_address = {{ .Values.config.meta.address | quote }}
meta_username = {{ .Values.config.meta.username | quote }}
meta_password = {{ .Values.config.meta.password | quote }}
meta_client_timeout_in_second = {{ .Values.config.meta.clientTimeoutInSecond | default 60 }}
meta_type = "remote"
endpoints = [{{ range .Values.config.meta.endpoints }}{{ . | quote }},{{ end }}]
username = {{ .Values.config.meta.username | quote }}
password = {{ .Values.config.meta.password | quote }}
client_timeout_in_second = {{ .Values.config.meta.clientTimeoutInSecond | default 60 }}
[storage]
storage_type = {{ .Values.config.storage.type | quote }}
{{- if eq .Values.config.storage.type "fs" }}
[storage.fs]
data_path = {{ .Values.config.storage.fs.dataPath | quote }}
{{- else if eq .Values.config.storage.type "s3"}}
[storage.s3]
bucket = {{ .Values.config.storage.s3.bucket | quote }}
{{- if .Values.minio.enabled }}
endpoint_url = "http://{{ printf "%s-%s.%s" .Release.Name "minio" .Release.Namespace }}:{{ .Values.minio.minioAPIPort }}"
access_key_id = {{ .Values.minio.rootUser | quote }}
secret_access_key = {{ .Values.minio.rootPassword | quote }}
{{- else }}
endpoint_url = {{ .Values.config.storage.s3.endpointUrl | quote}}
access_key_id = {{ .Values.config.storage.s3.accessKeyId | quote}}
secret_access_key = {{ .Values.config.storage.s3.secretAccessKey | quote }}
{{- end }}
{{- end }}
storage_type = {{ .Values.config.storage.type | quote }}
{{- if eq .Values.config.storage.type "fs" }}
[storage.fs]
{{- range $field, $value := .Values.config.storage.fs }}
{{- if (kindIs "string" $value) }}
{{ $field }} = {{ $value | quote }}
{{- else }}
{{ $field }} = {{ $value }}
{{- end }}
{{- end }}
{{- else if eq .Values.config.storage.type "s3"}}
[storage.s3]
{{- if .Values.minio.enabled }}
bucket = {{ .Values.config.storage.s3.bucket | quote }}
endpoint_url = "http://{{ printf "%s-%s.%s" .Release.Name "minio" .Release.Namespace }}:{{ .Values.minio.minioAPIPort }}"
access_key_id = {{ .Values.minio.rootUser | quote }}
secret_access_key = {{ .Values.minio.rootPassword | quote }}
{{- else }}
{{- range $field, $value := .Values.config.storage.s3 }}
{{- if (kindIs "string" $value) }}
{{ $field }} = {{ $value | quote }}
{{- else }}
{{ $field }} = {{ $value }}
{{- end }}
{{- end }}
{{- end }}
{{- else if eq .Values.config.storage.type "oss"}}
[storage.oss]
{{- range $field, $value := .Values.config.storage.oss }}
{{- if (kindIs "string" $value) }}
{{ $field }} = {{ $value | quote }}
{{- else }}
{{ $field }} = {{ $value }}
{{- end }}
{{- end }}
{{- end }}
8 changes: 4 additions & 4 deletions charts/databend-query/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
containers:
- name: {{ .Chart.Name }}
command:
- ./databend-query
- /databend-query
- -c
- /etc/databend-query/config.toml
securityContext:
Expand Down Expand Up @@ -80,11 +80,11 @@ spec:
fieldRef:
fieldPath: status.podIP
- name: QUERY_METRIC_API_ADDRESS
value: 0.0.0.0:7070
value: "$(POD_IP):7070"
- name: QUERY_ADMIN_API_ADDRESS
value: 0.0.0.0:8080
value: "$(POD_IP):8080"
- name: QUERY_FLIGHT_API_ADDRESS
value: 0.0.0.0:9090
value: "$(POD_IP):9090"
- name: QUERY_MYSQL_HANDLER_HOST
value: 0.0.0.0
- name: QUERY_MYSQL_HANDLER_PORT
Expand Down
42 changes: 32 additions & 10 deletions charts/databend-query/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ config:
maxActiveSessions: 256
waitTimeoutMills: 5000

tenantId: default
tenantId: ""
clusterId: default

# table cache config
Expand All @@ -58,16 +58,30 @@ config:
managementMode: false
jwtKeyFile: ""

users:
- name: databend
# available type: sha256_password, double_sha1_password, no_password, jwt
# sha1sum: echo -n "password" | sha1sum | cut -d' ' -f1 | xxd -r -p | sha1sum
authType: double_sha1_password
authString: 3081f32caef285c232d066033c89a78d88a6d8a5 # databend

# [log]
log:
level: "ERROR"
dir: "/data/databend-query/_log"
queryEnabled: false
file:
enabled: false
level: "INFO"
dir: "/data/databend-query/_log"
stderr:
enabled: true
level: "WARN"

# [meta]
meta:
# Set address to use remote meta service
address: ""
# Set endpoints to use remote meta service
endpoints:
- "databend-meta-0.databend-meta.databend-meta.svc:9191"
- "databend-meta-1.databend-meta.databend-meta.svc:9191"
- "databend-meta-2.databend-meta.databend-meta.svc:9191"
username: "root"
password: "root"
clientTimeoutInSecond: 60
Expand All @@ -77,14 +91,22 @@ config:
type: "fs"
# [storage.fs]
fs:
dataPath: "/data/databend-query/_data"
data_path: "/data/databend-query/_data"

# [storage.s3]
s3:
bucket: "databend"
endpointUrl: "https://s3.amazonaws.com"
accessKeyId: ""
secretAccessKey: ""
endpoint_url: "https://s3.amazonaws.com"
access_key_id: ""
secret_access_key: ""
enable_virtual_host_style: false

# [storage.oss]
oss:
bucket: "databend"
endpoint_url: "https://oss.aliyuncs.com"
access_key_id: ""
access_key_secret: ""

persistence:
enabled: false
Expand Down

0 comments on commit 946865b

Please sign in to comment.