Skip to content

Commit 85283b1

Browse files
committed
[yugabyte#20406] yugabyted: Fix yugabyted-ui when given custom YSQL and YCQL ports
Summary: Fixes an issue where yugabyted-ui breaks when yugabyted is given custom values for `ysql_port` and `ycql_port`. This happens because the values aren't passed to yugabyted-ui. The fix involves adding a new flag to yugabyted-ui for the YCQL port number, and also changing yugabyted to pass the values to yugabyted-ui Jira: DB-9402 Test Plan: no test plan Reviewers: sgarg-yb, nikhil Reviewed By: nikhil Subscribers: yugabyted-dev, djiang Differential Revision: https://phorge.dev.yugabyte.com/D31585
1 parent c93ccda commit 85283b1

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

bin/yugabyted

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,6 +1833,13 @@ class ControlScript(object):
18331833
"-database_password={}".format(
18341834
self.configs.saved_data.get("database_password"))])
18351835

1836+
if self.configs.saved_data.get("ysql_port"):
1837+
yugabyted_ui_cmd.append("-ysql_port={}".format(
1838+
self.configs.saved_data.get("ysql_port")))
1839+
if self.configs.saved_data.get("ycql_port"):
1840+
yugabyted_ui_cmd.append("-ycql_port={}".format(
1841+
self.configs.saved_data.get("ycql_port")))
1842+
18361843
self.processes["yugabyted-ui"] = ProcessManager(
18371844
"yugabyted-ui", yugabyted_ui_cmd,
18381845
self.configs.saved_data.get("log_dir"),

yugabyted-ui/apiserver/cmd/server/handlers/container.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (c *Container) GetConnectionFromMap(host string, database ...string) (*pgxp
5858
User: helpers.DbYsqlUser,
5959
Password: helpers.DbPassword,
6060
Host: host,
61-
Port: helpers.PORT,
61+
Port: helpers.YsqlPort,
6262
Database: dbName,
6363
}
6464

yugabyted-ui/apiserver/cmd/server/helpers/db_connections.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type PgClientConnectionParams struct {
2121
func (h *HelperContainer) CreateGoCqlClient(log logger.Logger) *gocql.ClusterConfig {
2222

2323
// Initialize gocql client
24-
cluster := gocql.NewCluster(HOST)
24+
cluster := gocql.NewCluster(fmt.Sprintf("%s:%d", HOST, YcqlPort))
2525

2626
if Secure {
2727
cluster.Authenticator = gocql.PasswordAuthenticator{

yugabyted-ui/apiserver/cmd/server/helpers/parse_command_line_flags.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import (
66

77
var (
88
HOST string
9-
PORT int
9+
YsqlPort int
10+
YcqlPort int
1011
Secure bool
1112
DbName string
1213
DbYsqlUser string
@@ -22,7 +23,8 @@ var (
2223
func init() {
2324
flag.StringVar(&HOST, "database_host", "127.0.0.1",
2425
"Advertise address of the local YugabyteDB node.")
25-
flag.IntVar(&PORT, "database_port", 5433, "YSQL port.")
26+
flag.IntVar(&YsqlPort, "ysql_port", 5433, "YSQL port.")
27+
flag.IntVar(&YcqlPort, "ycql_port", 9042, "YCQL port.")
2628
flag.BoolVar(&Secure, "secure", false, "API server use secure or insecure mode.")
2729
flag.StringVar(&DbName, "database_name", "yugabyte", "database for retrieving metrics.")
2830
flag.StringVar(&DbYsqlUser, "ysql_username", "yugabyte",

0 commit comments

Comments
 (0)