HBASE-14529 Respond to SIGHUP to reload config
Summary: Add a signal handler to reload the config. Test Plan: Send the command and see that configs get reloaded. Differential Revision: https://reviews.facebook.net/D47877
This commit is contained in:
parent
841f3924cd
commit
226f7a019a
|
@ -186,8 +186,9 @@ case $startStop in
|
||||||
hbase_rotate_log $HBASE_LOGOUT
|
hbase_rotate_log $HBASE_LOGOUT
|
||||||
hbase_rotate_log $HBASE_LOGGC
|
hbase_rotate_log $HBASE_LOGGC
|
||||||
echo starting $command, logging to $HBASE_LOGOUT
|
echo starting $command, logging to $HBASE_LOGOUT
|
||||||
nohup $thiscmd --config "${HBASE_CONF_DIR}" \
|
$thiscmd --config "${HBASE_CONF_DIR}" \
|
||||||
foreground_start $command $args < /dev/null > ${HBASE_LOGOUT} 2>&1 &
|
foreground_start $command $args < /dev/null > ${HBASE_LOGOUT} 2>&1 &
|
||||||
|
disown -h -r
|
||||||
sleep 1; head "${HBASE_LOGOUT}"
|
sleep 1; head "${HBASE_LOGOUT}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,7 @@ public class ConfigurationManager {
|
||||||
* all the observers that are expressed interest to do that.
|
* all the observers that are expressed interest to do that.
|
||||||
*/
|
*/
|
||||||
public void notifyAllObservers(Configuration conf) {
|
public void notifyAllObservers(Configuration conf) {
|
||||||
|
LOG.info("Starting to notify all observers that config changed.");
|
||||||
synchronized (configurationObservers) {
|
synchronized (configurationObservers) {
|
||||||
for (ConfigurationObserver observer : configurationObservers) {
|
for (ConfigurationObserver observer : configurationObservers) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -187,6 +187,8 @@ import com.google.protobuf.RpcCallback;
|
||||||
import com.google.protobuf.RpcController;
|
import com.google.protobuf.RpcController;
|
||||||
import com.google.protobuf.Service;
|
import com.google.protobuf.Service;
|
||||||
import com.google.protobuf.ServiceException;
|
import com.google.protobuf.ServiceException;
|
||||||
|
import sun.misc.Signal;
|
||||||
|
import sun.misc.SignalHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HRegionServer makes a set of HRegions available to clients. It checks in with
|
* HRegionServer makes a set of HRegions available to clients. It checks in with
|
||||||
|
@ -599,6 +601,13 @@ public class HRegionServer extends HasThread implements
|
||||||
putUpWebUI();
|
putUpWebUI();
|
||||||
this.walRoller = new LogRoller(this, this);
|
this.walRoller = new LogRoller(this, this);
|
||||||
this.choreService = new ChoreService(getServerName().toString());
|
this.choreService = new ChoreService(getServerName().toString());
|
||||||
|
|
||||||
|
Signal.handle(new Signal("HUP"), new SignalHandler() {
|
||||||
|
public void handle(Signal signal) {
|
||||||
|
getConfiguration().reloadConfiguration();
|
||||||
|
configurationManager.notifyAllObservers(getConfiguration());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue