Skip to content
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

Support plugin start argument for tidb instance #412

Merged
merged 3 commits into from
Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions charts/tidb-cluster/templates/scripts/_start_tidb.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ then
ARGS="${ARGS} --log-slow-query=${SLOW_LOG_FILE:-}"
fi

{{- if .Values.tidb.plugin.enable | default false }}
ARGS="${ARGS} --plugin-dir {{ .Values.tidb.plugin.directory }} --plugin-load {{ .Values.tidb.plugin.list }} "
{{- end }}

echo "start tidb-server ..."
echo "/tidb-server ${ARGS}"
exec /tidb-server ${ARGS}
9 changes: 9 additions & 0 deletions charts/tidb-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ tidb:
cpu: 20m
memory: 5Mi

# tidb plugin configuration
plugin:
# enable plugin or not
enable: false
# the start argument to specify the folder containing
directory: /plugins
# the start argument to specify the plugin id (name "-" version) that needs to be loaded, e.g. 'conn_limit-1'.
list: whitelist-1
Copy link
Contributor

@LinuxGit LinuxGit Apr 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there're multiple plugins, is list a comma separated string? I found a example, but not sure it works or not.https://github.com/helm/charts/blob/master/stable/opa/templates/deployment.yaml#L96

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes!
From the design document.
https://github.com/pingcap/tidb/blob/master/docs/design/2018-12-10-plugin-framework.md#Management

and tidb uage document
https://github.com/pingcap/tidb/blob/11d7199fcfbb66b1205ffa00f770f90f7b1ee9c1/tidb-server/main.go#L114

and the code that load plugins
https://github.com/pingcap/tidb/blob/11d7199fcfbb66b1205ffa00f770f90f7b1ee9c1/session/session.go#L1305

	if len(cfg.Plugin.Load) > 0 {
		err := plugin.Load(context.Background(), plugin.Config{
			Plugins:        strings.Split(cfg.Plugin.Load, ","),
			PluginDir:      cfg.Plugin.Dir,
			GlobalSysVar:   &variable.SysVars,
			PluginVarNames: &variable.PluginVarNames,
		})
		if err != nil {
			return nil, err
		}
	}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the plugin.list is changed to array


# mysqlClient is used to set password for TiDB
# it must has Python MySQL client installed
mysqlClient:
Expand Down