Skip to content

Add list-all capability to accumulo-service - #6508

Open
lbschanno wants to merge 6 commits into
apache:mainfrom
lbschanno:accumulo-6507
Open

Add list-all capability to accumulo-service#6508
lbschanno wants to merge 6 commits into
apache:mainfrom
lbschanno:accumulo-6507

Conversation

@lbschanno

@lbschanno lbschanno commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Currently the accumulo-service script only supports listing information for individual services. There are times when a user will want to retrieve the PIDs for all processes managed by Accumulo.

Modify the accumulo-service script to:

  • Add the service all that can be combined with the list command to list all processes.
  • Add the sub-option --json to make the list command print only the name, pid, and port of each process as json. The output will always be a json array.
  • Forbid the use of the service all with the start, stop, or kill command.

Closes #6507

Some examples on a running Accumulo instance:

Default output:

$ ./accumulo-service all list
Currently running gc processes (fields: process pid port):
gc_default_1 1989905 9998
Currently running manager processes (fields: process pid port):
manager_default_1 1990414 9999
Currently running monitor processes (fields: process pid port):
monitor_default_1 1989912 9995
Currently running tserver processes (fields: process pid port):
tserver_default_1 1989881 9800
Currently running compactor processes (fields: process pid port):
compactor_default_1 1989938 9600
Currently running sserver processes (fields: process pid port):
sserver_default_1 1989927 9700

Using the --json option combined with all:

$ ./accumulo-service all list --json
[
  {
    "process": "gc_default_1",
    "pid": "2001397",
    "port": "9998"
  },
  {
    "process": "manager_default_1",
    "pid": "2001906",
    "port": "9999"
  },
  {
    "process": "monitor_default_1",
    "pid": "2001399",
    "port": "9995"
  },
  {
    "process": "tserver_default_1",
    "pid": "2001374",
    "port": "9800"
  },
  {
    "process": "compactor_default_1",
    "pid": "2001434",
    "port": "9600"
  },
  {
    "process": "sserver_default_1",
    "pid": "2001426",
    "port": "9700"
  }
]

Using the --json option always results in a json array, even when there's just a single element:

$ ./accumulo-service gc list --json
[
  {
    "process": "gc_default_1",
    "pid": "2001397",
    "port": "9998"
  }
]

Using all is forbidden with any command other than list:

$ ./accumulo-service all stop
Invalid arguments: Service all can only be used with the list command

Usage: accumulo-service <service> <command>

Services:
  gc                     Accumulo garbage collector
  monitor                Accumulo monitor
  manager                Accumulo manager
  tserver                Accumulo tserver
  compactor              Accumulo compactor
  sserver                Accumulo scan server
  all                    All services (list command only)
Commands:
  start                   Starts service(s)
  stop [--all | [<name>]] Stops service(s)
  kill [--all | [<name>]] Kills service(s)
  list [--json]           List running service(s)

Currently the accumulo-service script only supports listing information
for individual services. There are times when a user will want to
retrieve the PIDs for all processes managed by Accumulo.

Modify the accumulo-service script to:
- Add the service `all` that can be combined with the list command to
  list all processes.
- Add the sub-options `-p`, `--parseable` to make the list command print
  only the name, pid, and port of each process for consistently
  formatted output.
- Forbid the use of the service `all` with the start, stop, or kill
  command.

Closes apache#6507
@dlmarion

Copy link
Copy Markdown
Contributor

Seems like a good change. We have had conversations about making script / command output more CLI friendly, which is what you are trying to achieve here. I think we settled on JSON (@ctubbsii correct me here) so that the output could be parsed with jq or similar tool.

@dlmarion

Copy link
Copy Markdown
Contributor

Seems like a good change. We have had conversations about making script / command output more CLI friendly, which is what you are trying to achieve here. I think we settled on JSON (@ctubbsii correct me here) so that the output could be parsed with jq or similar tool.

I was thinking of #6391

@lbschanno

Copy link
Copy Markdown
Contributor Author

I like the idea. Do you want me to switch out -p and --parseable for --json and update the script to print out json when prompted for the list command?

@dlmarion

Copy link
Copy Markdown
Contributor

I like the idea. Do you want me to switch out -p and --parseable for --json and update the script to print out json when prompted for the list command?

I think that would be good. I looked at the code earlier with this in mind and I don't think it's a heavy lift.

Add the flag --json for the accumulo-service list command. When
specified, the caller will receive output formatted as json.
@lbschanno

Copy link
Copy Markdown
Contributor Author

Done. Updated the top comment with new examples reflecting the --json option.

@dlmarion

dlmarion commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Done. Updated the top comment with new examples reflecting the --json option.

The json in the comment is invalid. One option is to add a leading [, trailing ], and , in between the objects, like:

[{
  "process": "gc_default_1",
  "pid": "1989905",
  "port": "9998"
},
{
  "process": "manager_default_1",
  "pid": "1990414",
  "port": "9999"
},
{
  "process": "monitor_default_1",
  "pid": "1989912",
  "port": "9995"
},
{
  "process": "tserver_default_1",
  "pid": "1989881",
  "port": "9800"
},
{
  "process": "compactor_default_1",
  "pid": "1989938",
  "port": "9600"
},
{
  "process": "sserver_default_1",
  "pid": "1989927",
  "port": "9700"
}]

I used json_verify to validate the json. You should be able to use that or jq.

@lbschanno

Copy link
Copy Markdown
Contributor Author

Ah yes, you're right, silly of me. Fixing that now.

@lbschanno

Copy link
Copy Markdown
Contributor Author

Fixed to output valid json. Top comment examples are updated.

@dlmarion

Copy link
Copy Markdown
Contributor

I think your IDE messed with the spacing or something.

@lbschanno

Copy link
Copy Markdown
Contributor Author

Fixed.

Comment thread assemble/bin/accumulo-service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

List-all capability for accumulo-service

2 participants