Skip to content

Commit 2bf8e2f

Browse files
committed
change default cassandra jmx name
1 parent 7d9542c commit 2bf8e2f

File tree

4 files changed

+31
-26
lines changed

4 files changed

+31
-26
lines changed

catalog/cassandra/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ firecamp-service-cli -op=scale-service -service-type=cassandra -region=us-east-1
2424

2525
3. Use [nodetool status](https://docs.datastax.com/en/cassandra/3.0/cassandra/tools/toolsStatus.html) to verify the new replicas are fully bootstrapped and all other nodes are up (UN).
2626
```
27-
nodetool -h mycas-3.t1-firecamp.com -u cassandrajmx -pw changeme status
28-
nodetool -h mycas-4.t1-firecamp.com -u cassandrajmx -pw changeme status
29-
nodetool -h mycas-5.t1-firecamp.com -u cassandrajmx -pw changeme status
27+
nodetool -h mycas-3.t1-firecamp.com -u jmxuser -pw changeme status
28+
nodetool -h mycas-4.t1-firecamp.com -u jmxuser -pw changeme status
29+
nodetool -h mycas-5.t1-firecamp.com -u jmxuser -pw changeme status
3030
```
3131

3232
4. Run [nodetool cleanup](https://docs.datastax.com/en/cassandra/3.0/cassandra/tools/toolsCleanup.html) on each of the previously existing nodes to remove the keys that no longer belong to those nodes. Wait for cleanup to complete on one node before running nodetool cleanup on the next node. Cleanup can be safely postponed for low-usage hours.
3333
```
34-
nodetool -h mycas-0.t1-firecamp.com -u cassandrajmx -pw changeme cleanup
35-
nodetool -h mycas-1.t1-firecamp.com -u cassandrajmx -pw changeme cleanup
36-
nodetool -h mycas-2.t1-firecamp.com -u cassandrajmx -pw changeme cleanup
34+
nodetool -h mycas-0.t1-firecamp.com -u jmxuser -pw changeme cleanup
35+
nodetool -h mycas-1.t1-firecamp.com -u jmxuser -pw changeme cleanup
36+
nodetool -h mycas-2.t1-firecamp.com -u jmxuser -pw changeme cleanup
3737
```
3838

3939
Currently FireCamp only supports scaling from 3 replicas. Scaling from 1 replica is not supported yet. Scaling down the replicas are not supported as well. If you want to stop the service when idle, could run `firecamp-service-cli -op=stop-service -service-name=mycas`. This will stop the service containers, while the volumes are still there. Later could start the containers with `firecamp-service-cli -op=start-service -service-name=mycas`.
@@ -87,7 +87,7 @@ The Cassandra logs are sent to the Cloud Logs, such as AWS CloudWatch logs.
8787

8888
**[JMX](https://docs.datastax.com/en/cassandra/3.0/cassandra/configuration/secureJmxAuthentication.html)**
8989

90-
By default, JMX is enabled to allow tools such as nodetool to access the Cassandra replica remotely. You could specify the JMX user and password when creating the service. If you do not specify the JMX user and password, the default user is "cassandrajmx" and an UUID will be generated as the password.
90+
By default, JMX is enabled to allow tools such as nodetool to access the Cassandra replica remotely. You could specify the JMX user and password when creating the service. If you do not specify the JMX user and password, the default user is "jmxuser" and an UUID will be generated as the password.
9191

9292
**[JVM Configs](https://docs.datastax.com/en/cassandra/2.1/cassandra/operations/ops_tune_jvm_c.html)**
9393

@@ -135,9 +135,9 @@ In case the service creation fails, please simply retry it. Once the service is
135135

136136
## Check Cassandra service status
137137

138-
The Cassandra service creation will return the cassandra jmx password, such as `2018-02-11 21:13:10.524442554 +0000 UTC The catalog service is created, jmx user cassandrajmx password 9ba31d4787504894638611e0aeb91c93`.
138+
The Cassandra service creation will return the cassandra jmx password, such as `2018-02-11 21:13:10.524442554 +0000 UTC The catalog service is created, jmx user jmxuser password 9ba31d4787504894638611e0aeb91c93`.
139139

140-
To double check Cassandra is successfully initialized and includes all replicas, run `nodetool -h mycas-0.t1-firecamp.com -u cassandrajmx -pw 9ba31d4787504894638611e0aeb91c93 status`. It should include all replicas. In case, if some replica is not included, for example, you create a 6 replicas Cassandra service, but nodetool shows only 5 members, use firecamp-service-cli to stop the services, `firecamp-service-cli -region=us-east-1 -cluster=t1 -op=stop-service -service-name=mycas`, and start again with `firecamp-service-cli -region=us-east-1 -cluster=t1 -op=start-service -service-name=mycas`. Then check with nodetool again.
140+
To double check Cassandra is successfully initialized and includes all replicas, run `nodetool -h mycas-0.t1-firecamp.com -u jmxuser -pw 9ba31d4787504894638611e0aeb91c93 status`. It should include all replicas. In case, if some replica is not included, for example, you create a 6 replicas Cassandra service, but nodetool shows only 5 members, use firecamp-service-cli to stop the services, `firecamp-service-cli -region=us-east-1 -cluster=t1 -op=stop-service -service-name=mycas`, and start again with `firecamp-service-cli -region=us-east-1 -cluster=t1 -op=start-service -service-name=mycas`. Then check with nodetool again.
141141

142142
## Create the New Super User
143143
Cassandra has a default super user, name "cassandra" and password "cassandra". After the Cassandra service is initialized, please login to create a new superuser and disable the default "cassandra" superuser. The steps are:

catalog/cassandra/cascatalog.go

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,18 @@ const (
2929
MaxHeapMB = 14 * 1024
3030
// MinHeapMB is the minimal JVM heap size. If heap < 1024, jvm may stall long time at gc.
3131
MinHeapMB = 1024
32-
// DefaultJmxRemoteUser is the default jmx remote user.
33-
DefaultJmxRemoteUser = "cassandrajmx"
3432

3533
intraNodePort = 7000
3634
tlsIntraNodePort = 7001
3735
jmxPort = 7199
3836
cqlPort = 9042
3937
thriftPort = 9160
4038

41-
yamlConfFileName = "cassandra.yaml"
42-
rackdcConfFileName = "cassandra-rackdc.properties"
43-
jvmConfFileName = "jvm.options"
44-
logConfFileName = "logback.xml"
45-
jmxRemotePasswdConfFileName = "jmxremote.password"
46-
47-
jmxRemotePasswdConfFileMode = 0400
39+
yamlConfFileName = "cassandra.yaml"
40+
rackdcConfFileName = "cassandra-rackdc.properties"
41+
jvmConfFileName = "jvm.options"
42+
logConfFileName = "logback.xml"
43+
// jmx file is defined in catalog/types.go
4844
)
4945

5046
// The default Cassandra catalog service. By default,
@@ -85,7 +81,7 @@ func GenDefaultCreateServiceRequest(platform string, region string, azs []string
8581
cluster string, service string, opts *manage.CatalogCassandraOptions, res *common.Resources) (*manage.CreateServiceRequest, error) {
8682
// generate service ReplicaConfigs
8783
if len(opts.JmxRemoteUser) == 0 {
88-
opts.JmxRemoteUser = DefaultJmxRemoteUser
84+
opts.JmxRemoteUser = catalog.JmxDefaultRemoteUser
8985
}
9086
if len(opts.JmxRemotePasswd) == 0 {
9187
opts.JmxRemotePasswd = utils.GenUUID()
@@ -209,9 +205,9 @@ func GenReplicaConfigs(platform string, region string, cluster string, service s
209205

210206
// create the jmxremote.password file
211207
jmxCfg := &manage.ReplicaConfigFile{
212-
FileName: jmxRemotePasswdConfFileName,
213-
FileMode: jmxRemotePasswdConfFileMode,
214-
Content: fmt.Sprintf("%s %s\n", opts.JmxRemoteUser, opts.JmxRemotePasswd),
208+
FileName: catalog.JmxRemotePasswdConfFileName,
209+
FileMode: catalog.JmxRemotePasswdConfFileMode,
210+
Content: fmt.Sprintf(catalog.JmxFileContent, opts.JmxRemoteUser, opts.JmxRemotePasswd),
215211
}
216212

217213
configs := []*manage.ReplicaConfigFile{sysCfg, yamlCfg, rackdcCfg, jvmCfg, logCfg, jmxCfg}
@@ -295,12 +291,12 @@ func NewJVMConfContent(heapSizeMB int64) string {
295291

296292
// IsJmxConfFile checks if the file is jmx conf file
297293
func IsJmxConfFile(filename string) bool {
298-
return filename == jmxRemotePasswdConfFileName
294+
return filename == catalog.JmxRemotePasswdConfFileName
299295
}
300296

301297
// NewJmxConfContent returns the new jmxremote.password file content
302298
func NewJmxConfContent(jmxUser string, jmxPasswd string) string {
303-
return fmt.Sprintf("%s %s\n", jmxUser, jmxPasswd)
299+
return fmt.Sprintf(catalog.JmxFileContent, jmxUser, jmxPasswd)
304300
}
305301

306302
const (

catalog/types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,12 @@ const (
55
SYS_FILE_NAME = "sys.conf"
66

77
BindAllIP = "0.0.0.0"
8+
9+
JmxRemotePasswdConfFileName = "jmxremote.password"
10+
JmxRemotePasswdConfFileMode = 0400
11+
// the default password is uuid for better security
12+
// every service will define its own jmx port
13+
JmxDefaultRemoteUser = "jmxuser"
14+
// jmx file content format: "user passwd"
15+
JmxFileContent = "%s %s\n"
816
)

syssvc/firecamp-service-cli/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414

1515
"golang.org/x/net/context"
1616

17+
"github.com/cloudstax/firecamp/catalog"
1718
"github.com/cloudstax/firecamp/catalog/cassandra"
1819
"github.com/cloudstax/firecamp/catalog/consul"
1920
"github.com/cloudstax/firecamp/catalog/elasticsearch"
@@ -81,8 +82,8 @@ var (
8182

8283
// The Cassandra service specific parameters
8384
casHeapSizeMB = flag.Int64("cas-heap-size", cascatalog.DefaultHeapMB, "The Cassandra JVM heap size, unit: MB")
84-
casJmxUser = flag.String("cas-jmx-user", cascatalog.DefaultJmxRemoteUser, "The Cassandra JMX remote user")
85-
casJmxPasswd = flag.String("cas-jmx-passwd", "", "The Cassandra JMX. If leave as empty, an uuid will be generated automatically")
85+
casJmxUser = flag.String("cas-jmx-user", catalog.JmxDefaultRemoteUser, "The Cassandra JMX remote user")
86+
casJmxPasswd = flag.String("cas-jmx-passwd", "", "The Cassandra JMX password. If leave as empty, an uuid will be generated automatically")
8687

8788
// The postgres service creation specific parameters.
8889
pgReplUser = flag.String("pg-repluser", "repluser", "The PostgreSQL replication user that the standby DB replicates from the primary")

0 commit comments

Comments
 (0)