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

Adds new accumulo command #5073

Merged
merged 10 commits into from
Dec 16, 2024
Merged
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,45 @@
*/
package org.apache.accumulo.server.conf;

import java.io.IOException;

import org.apache.accumulo.core.conf.SiteConfiguration;
import org.apache.accumulo.server.ServerContext;
import org.apache.accumulo.server.ServerDirs;
import org.apache.accumulo.server.fs.VolumeManager;
import org.apache.accumulo.server.fs.VolumeManagerImpl;
import org.apache.accumulo.start.spi.KeywordExecutable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;

import com.google.auto.service.AutoService;

@AutoService(KeywordExecutable.class)
public class CheckServerConfig implements KeywordExecutable {

public static void main(String[] args) {
try (var context = new ServerContext(SiteConfiguration.auto())) {
var siteConfig = SiteConfiguration.auto();
var hadoopConfig = new Configuration();
VolumeManager volumeManager;
try {
volumeManager = VolumeManagerImpl.get(siteConfig, hadoopConfig);
} catch (IOException e) {
throw new IllegalStateException(e);
}
var serverDirs = new ServerDirs(siteConfig, hadoopConfig);
Path instanceIdPath = serverDirs.getInstanceIdLocation(volumeManager.getFirst());
// Check if an instance exists. If it doesn't, we have performed all the checks we can.
// If it does, we can perform further checks.
try {
VolumeManager.getInstanceIDFromHdfs(instanceIdPath, hadoopConfig);
} catch (Exception e) {
System.out.println("WARNING : Performed only a subset of checks (which passed). There is a "
ctubbsii marked this conversation as resolved.
Show resolved Hide resolved
+ "problem relating to the instance:\n" + e.getMessage()
+ "\nand no further checks could be done. If this is unexpected, make sure an instance "
+ "is running and re-run the command.");
System.exit(0);
}
try (var context = new ServerContext(siteConfig)) {
context.getConfiguration();
}
}
Expand Down