Search in sources :

Example 1 with CompoundConfiguration

use of org.apache.hadoop.hbase.CompoundConfiguration in project hbase by apache.

the class HBaseAdmin method getPeerClusterConfiguration.

/**
   * Returns the configuration needed to talk to the remote slave cluster.
   * @param peer the description of replication peer
   * @return the configuration for the peer cluster, null if it was unable to get the configuration
   * @throws IOException
   */
private Configuration getPeerClusterConfiguration(ReplicationPeerDescription peer) throws IOException {
    ReplicationPeerConfig peerConfig = peer.getPeerConfig();
    Configuration otherConf;
    try {
        otherConf = HBaseConfiguration.createClusterConf(this.conf, peerConfig.getClusterKey());
    } catch (IOException e) {
        throw new IOException("Can't get peer configuration for peerId=" + peer.getPeerId(), e);
    }
    if (!peerConfig.getConfiguration().isEmpty()) {
        CompoundConfiguration compound = new CompoundConfiguration();
        compound.add(otherConf);
        compound.addStringMap(peerConfig.getConfiguration());
        return compound;
    }
    return otherConf;
}
Also used : ReplicationPeerConfig(org.apache.hadoop.hbase.replication.ReplicationPeerConfig) Configuration(org.apache.hadoop.conf.Configuration) CompoundConfiguration(org.apache.hadoop.hbase.CompoundConfiguration) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) CompoundConfiguration(org.apache.hadoop.hbase.CompoundConfiguration) InterruptedIOException(java.io.InterruptedIOException) IOException(java.io.IOException) DoNotRetryIOException(org.apache.hadoop.hbase.DoNotRetryIOException) TimeoutIOException(org.apache.hadoop.hbase.exceptions.TimeoutIOException)

Example 2 with CompoundConfiguration

use of org.apache.hadoop.hbase.CompoundConfiguration in project hbase by apache.

the class ReplicationUtils method getPeerClusterConfiguration.

public static Configuration getPeerClusterConfiguration(ReplicationPeerConfig peerConfig, Configuration baseConf) throws ReplicationException {
    Configuration otherConf;
    try {
        otherConf = HBaseConfiguration.createClusterConf(baseConf, peerConfig.getClusterKey());
    } catch (IOException e) {
        throw new ReplicationException("Can't get peer configuration for peer " + peerConfig, e);
    }
    if (!peerConfig.getConfiguration().isEmpty()) {
        CompoundConfiguration compound = new CompoundConfiguration();
        compound.add(otherConf);
        compound.addStringMap(peerConfig.getConfiguration());
        return compound;
    }
    return otherConf;
}
Also used : HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) Configuration(org.apache.hadoop.conf.Configuration) CompoundConfiguration(org.apache.hadoop.hbase.CompoundConfiguration) CompoundConfiguration(org.apache.hadoop.hbase.CompoundConfiguration) IOException(java.io.IOException)

Example 3 with CompoundConfiguration

use of org.apache.hadoop.hbase.CompoundConfiguration in project hbase by apache.

the class ReplicationPeerConfigUtil method getPeerClusterConfiguration.

/**
 * Returns the configuration needed to talk to the remote slave cluster.
 * @param conf the base configuration
 * @param peer the description of replication peer
 * @return the configuration for the peer cluster, null if it was unable to get the configuration
 * @throws IOException when create peer cluster configuration failed
 */
public static Configuration getPeerClusterConfiguration(Configuration conf, ReplicationPeerDescription peer) throws IOException {
    ReplicationPeerConfig peerConfig = peer.getPeerConfig();
    Configuration otherConf;
    try {
        otherConf = HBaseConfiguration.createClusterConf(conf, peerConfig.getClusterKey());
    } catch (IOException e) {
        throw new IOException("Can't get peer configuration for peerId=" + peer.getPeerId(), e);
    }
    if (!peerConfig.getConfiguration().isEmpty()) {
        CompoundConfiguration compound = new CompoundConfiguration();
        compound.add(otherConf);
        compound.addStringMap(peerConfig.getConfiguration());
        return compound;
    }
    return otherConf;
}
Also used : ReplicationPeerConfig(org.apache.hadoop.hbase.replication.ReplicationPeerConfig) Configuration(org.apache.hadoop.conf.Configuration) CompoundConfiguration(org.apache.hadoop.hbase.CompoundConfiguration) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) CompoundConfiguration(org.apache.hadoop.hbase.CompoundConfiguration) IOException(java.io.IOException)

Example 4 with CompoundConfiguration

use of org.apache.hadoop.hbase.CompoundConfiguration in project hbase by apache.

the class AccessController method start.

/* ---- MasterObserver implementation ---- */
@Override
public void start(CoprocessorEnvironment env) throws IOException {
    CompoundConfiguration conf = new CompoundConfiguration();
    conf.add(env.getConfiguration());
    authorizationEnabled = AccessChecker.isAuthorizationSupported(conf);
    if (!authorizationEnabled) {
        LOG.warn("AccessController has been loaded with authorization checks DISABLED!");
    }
    shouldCheckExecPermission = conf.getBoolean(AccessControlConstants.EXEC_PERMISSION_CHECKS_KEY, AccessControlConstants.DEFAULT_EXEC_PERMISSION_CHECKS);
    cellFeaturesEnabled = (HFile.getFormatVersion(conf) >= HFile.MIN_FORMAT_VERSION_WITH_TAGS);
    if (!cellFeaturesEnabled) {
        LOG.info("A minimum HFile version of " + HFile.MIN_FORMAT_VERSION_WITH_TAGS + " is required to persist cell ACLs. Consider setting " + HFile.FORMAT_VERSION_KEY + " accordingly.");
    }
    if (env instanceof MasterCoprocessorEnvironment) {
        // if running on HMaster
        MasterCoprocessorEnvironment mEnv = (MasterCoprocessorEnvironment) env;
        if (mEnv instanceof HasMasterServices) {
            MasterServices masterServices = ((HasMasterServices) mEnv).getMasterServices();
            zkPermissionWatcher = masterServices.getZKPermissionWatcher();
            accessChecker = masterServices.getAccessChecker();
        }
    } else if (env instanceof RegionServerCoprocessorEnvironment) {
        RegionServerCoprocessorEnvironment rsEnv = (RegionServerCoprocessorEnvironment) env;
        if (rsEnv instanceof HasRegionServerServices) {
            RegionServerServices rsServices = ((HasRegionServerServices) rsEnv).getRegionServerServices();
            zkPermissionWatcher = rsServices.getZKPermissionWatcher();
            accessChecker = rsServices.getAccessChecker();
        }
    } else if (env instanceof RegionCoprocessorEnvironment) {
        // if running at region
        regionEnv = (RegionCoprocessorEnvironment) env;
        conf.addBytesMap(regionEnv.getRegion().getTableDescriptor().getValues());
        compatibleEarlyTermination = conf.getBoolean(AccessControlConstants.CF_ATTRIBUTE_EARLY_OUT, AccessControlConstants.DEFAULT_ATTRIBUTE_EARLY_OUT);
        if (regionEnv instanceof HasRegionServerServices) {
            RegionServerServices rsServices = ((HasRegionServerServices) regionEnv).getRegionServerServices();
            zkPermissionWatcher = rsServices.getZKPermissionWatcher();
            accessChecker = rsServices.getAccessChecker();
        }
    }
    Preconditions.checkState(zkPermissionWatcher != null, "ZKPermissionWatcher is null");
    Preconditions.checkState(accessChecker != null, "AccessChecker is null");
    // set the user-provider.
    this.userProvider = UserProvider.instantiate(env.getConfiguration());
    tableAcls = new MapMaker().weakValues().makeMap();
}
Also used : HasMasterServices(org.apache.hadoop.hbase.coprocessor.HasMasterServices) RegionServerCoprocessorEnvironment(org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessorEnvironment) RegionCoprocessorEnvironment(org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment) HasRegionServerServices(org.apache.hadoop.hbase.coprocessor.HasRegionServerServices) RegionServerServices(org.apache.hadoop.hbase.regionserver.RegionServerServices) HasRegionServerServices(org.apache.hadoop.hbase.coprocessor.HasRegionServerServices) MapMaker(org.apache.hbase.thirdparty.com.google.common.collect.MapMaker) CompoundConfiguration(org.apache.hadoop.hbase.CompoundConfiguration) MasterCoprocessorEnvironment(org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment) MasterServices(org.apache.hadoop.hbase.master.MasterServices) HasMasterServices(org.apache.hadoop.hbase.coprocessor.HasMasterServices)

Example 5 with CompoundConfiguration

use of org.apache.hadoop.hbase.CompoundConfiguration in project hbase by apache.

the class ReplicationPeersZKImpl method getPeerConf.

@Override
public Pair<ReplicationPeerConfig, Configuration> getPeerConf(String peerId) throws ReplicationException {
    ReplicationPeerConfig peerConfig = getReplicationPeerConfig(peerId);
    if (peerConfig == null) {
        return null;
    }
    Configuration otherConf;
    try {
        otherConf = HBaseConfiguration.createClusterConf(this.conf, peerConfig.getClusterKey());
    } catch (IOException e) {
        LOG.error("Can't get peer configuration for peerId=" + peerId + " because:", e);
        return null;
    }
    if (!peerConfig.getConfiguration().isEmpty()) {
        CompoundConfiguration compound = new CompoundConfiguration();
        compound.add(otherConf);
        compound.addStringMap(peerConfig.getConfiguration());
        return new Pair<>(peerConfig, compound);
    }
    return new Pair<>(peerConfig, otherConf);
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) CompoundConfiguration(org.apache.hadoop.hbase.CompoundConfiguration) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) CompoundConfiguration(org.apache.hadoop.hbase.CompoundConfiguration) IOException(java.io.IOException) Pair(org.apache.hadoop.hbase.util.Pair)

Aggregations

CompoundConfiguration (org.apache.hadoop.hbase.CompoundConfiguration)6 IOException (java.io.IOException)5 Configuration (org.apache.hadoop.conf.Configuration)4 HBaseConfiguration (org.apache.hadoop.hbase.HBaseConfiguration)4 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)2 ReplicationPeerConfig (org.apache.hadoop.hbase.replication.ReplicationPeerConfig)2 InterruptedIOException (java.io.InterruptedIOException)1 ColumnFamilyDescriptor (org.apache.hadoop.hbase.client.ColumnFamilyDescriptor)1 HasMasterServices (org.apache.hadoop.hbase.coprocessor.HasMasterServices)1 HasRegionServerServices (org.apache.hadoop.hbase.coprocessor.HasRegionServerServices)1 MasterCoprocessorEnvironment (org.apache.hadoop.hbase.coprocessor.MasterCoprocessorEnvironment)1 RegionCoprocessorEnvironment (org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment)1 RegionServerCoprocessorEnvironment (org.apache.hadoop.hbase.coprocessor.RegionServerCoprocessorEnvironment)1 TimeoutIOException (org.apache.hadoop.hbase.exceptions.TimeoutIOException)1 MasterServices (org.apache.hadoop.hbase.master.MasterServices)1 RegionServerServices (org.apache.hadoop.hbase.regionserver.RegionServerServices)1 Pair (org.apache.hadoop.hbase.util.Pair)1 MapMaker (org.apache.hbase.thirdparty.com.google.common.collect.MapMaker)1