当前位置: 首页>>代码示例>>Java>>正文


Java DatabaseDescriptor.isAutoBootstrap方法代码示例

本文整理汇总了Java中org.apache.cassandra.config.DatabaseDescriptor.isAutoBootstrap方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseDescriptor.isAutoBootstrap方法的具体用法?Java DatabaseDescriptor.isAutoBootstrap怎么用?Java DatabaseDescriptor.isAutoBootstrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.config.DatabaseDescriptor的用法示例。


在下文中一共展示了DatabaseDescriptor.isAutoBootstrap方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setup

import org.apache.cassandra.config.DatabaseDescriptor; //导入方法依赖的package包/类
public void setup()
{
    setupCredentialsTable();

    // the delay is here to give the node some time to see its peers - to reduce
    // "skipped default user setup: some nodes are were not ready" log spam.
    // It's the only reason for the delay.
    if (DatabaseDescriptor.getSeeds().contains(FBUtilities.getBroadcastAddress()) || !DatabaseDescriptor.isAutoBootstrap())
    {
        StorageService.tasks.schedule(new Runnable()
                                      {
                                          public void run()
                                          {
                                              setupDefaultUser();
                                          }
                                      },
                                      Auth.SUPERUSER_SETUP_DELAY,
                                      TimeUnit.MILLISECONDS);
    }

    try
    {
        String query = String.format("SELECT %s FROM %s.%s WHERE username = ?",
                                     SALTED_HASH,
                                     Auth.AUTH_KS,
                                     CREDENTIALS_CF);
        authenticateStatement = (SelectStatement) QueryProcessor.parseStatement(query).prepare().statement;
    }
    catch (RequestValidationException e)
    {
        throw new AssertionError(e); // not supposed to happen
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:34,代码来源:PasswordAuthenticator.java

示例2: shouldBootstrap

import org.apache.cassandra.config.DatabaseDescriptor; //导入方法依赖的package包/类
private boolean shouldBootstrap()
{
    return DatabaseDescriptor.isAutoBootstrap() && !SystemKeyspace.bootstrapComplete() && !DatabaseDescriptor.getSeeds().contains(FBUtilities.getBroadcastAddress());
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:5,代码来源:StorageService.java

示例3: prepareToJoin

import org.apache.cassandra.config.DatabaseDescriptor; //导入方法依赖的package包/类
private void prepareToJoin() throws ConfigurationException
{
    if (!joined)
    {
        Map<ApplicationState, VersionedValue> appStates = new HashMap<>();

        if (DatabaseDescriptor.isReplacing() && !(Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true"))))
            throw new ConfigurationException("Cannot set both join_ring=false and attempt to replace a node");
        if (DatabaseDescriptor.getReplaceTokens().size() > 0 || DatabaseDescriptor.getReplaceNode() != null)
            throw new RuntimeException("Replace method removed; use cassandra.replace_address instead");
        if (DatabaseDescriptor.isReplacing())
        {
            if (SystemKeyspace.bootstrapComplete())
                throw new RuntimeException("Cannot replace address with a node that is already bootstrapped");
            if (!DatabaseDescriptor.isAutoBootstrap())
                throw new RuntimeException("Trying to replace_address with auto_bootstrap disabled will not work, check your configuration");
            bootstrapTokens = prepareReplacementInfo();
            appStates.put(ApplicationState.TOKENS, valueFactory.tokens(bootstrapTokens));
            appStates.put(ApplicationState.STATUS, valueFactory.hibernate(true));
        }
        else if (shouldBootstrap())
        {
            checkForEndpointCollision();
        }

        // have to start the gossip service before we can see any info on other nodes.  this is necessary
        // for bootstrap to get the load info it needs.
        // (we won't be part of the storage ring though until we add a counterId to our state, below.)
        // Seed the host ID-to-endpoint map with our own ID.
        UUID localHostId = SystemKeyspace.getLocalHostId();
        getTokenMetadata().updateHostId(localHostId, FBUtilities.getBroadcastAddress());
        appStates.put(ApplicationState.NET_VERSION, valueFactory.networkVersion());
        appStates.put(ApplicationState.HOST_ID, valueFactory.hostId(localHostId));
        appStates.put(ApplicationState.RPC_ADDRESS, valueFactory.rpcaddress(DatabaseDescriptor.getBroadcastRpcAddress()));
        appStates.put(ApplicationState.RELEASE_VERSION, valueFactory.releaseVersion());
        logger.info("Starting up server gossip");
        Gossiper.instance.register(this);
        Gossiper.instance.start(SystemKeyspace.incrementAndGetGeneration(), appStates); // needed for node-ring gathering.
        // gossip snitch infos (local DC and rack)
        gossipSnitchInfo();
        // gossip Schema.emptyVersion forcing immediate check for schema updates (see MigrationManager#maybeScheduleSchemaPull)
        Schema.instance.updateVersionAndAnnounce(); // Ensure we know our own actual Schema UUID in preparation for updates

        if (!MessagingService.instance().isListening())
            MessagingService.instance().listen(FBUtilities.getLocalAddress());
        LoadBroadcaster.instance.startBroadcasting();

        HintedHandOffManager.instance.start();
        BatchlogManager.instance.start();
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:52,代码来源:StorageService.java

示例4: setup

import org.apache.cassandra.config.DatabaseDescriptor; //导入方法依赖的package包/类
/**
 * Sets up Authenticator and Authorizer.
 */
public static void setup()
{
    if (DatabaseDescriptor.getAuthenticator() instanceof AllowAllAuthenticator)
        return;

    setupAuthKeyspace();
    setupUsersTable();

    DatabaseDescriptor.getAuthenticator().setup();
    DatabaseDescriptor.getAuthorizer().setup();

    // register a custom MigrationListener for permissions cleanup after dropped keyspaces/cfs.
    MigrationManager.instance.register(new MigrationListener());

    // the delay is here to give the node some time to see its peers - to reduce
    // "Skipped default superuser setup: some nodes were not ready" log spam.
    // It's the only reason for the delay.
    if (DatabaseDescriptor.getSeeds().contains(FBUtilities.getBroadcastAddress()) || !DatabaseDescriptor.isAutoBootstrap())
    {
        StorageService.tasks.schedule(new Runnable()
                                      {
                                          public void run()
                                          {
                                              setupDefaultSuperuser();
                                          }
                                      },
                                      SUPERUSER_SETUP_DELAY,
                                      TimeUnit.MILLISECONDS);
    }

    try
    {
        String query = String.format("SELECT * FROM %s.%s WHERE name = ?", AUTH_KS, USERS_CF);
        selectUserStatement = (SelectStatement) QueryProcessor.parseStatement(query).prepare().statement;
    }
    catch (RequestValidationException e)
    {
        throw new AssertionError(e); // not supposed to happen
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:44,代码来源:Auth.java

示例5: prepareToJoin

import org.apache.cassandra.config.DatabaseDescriptor; //导入方法依赖的package包/类
private void prepareToJoin() throws ConfigurationException
{
    if (!joined)
    {
        Map<ApplicationState, VersionedValue> appStates = new EnumMap<>(ApplicationState.class);

        if (SystemKeyspace.wasDecommissioned())
        {
            if (Boolean.getBoolean("cassandra.override_decommission"))
            {
                logger.warn("This node was decommissioned, but overriding by operator request.");
                SystemKeyspace.setBootstrapState(SystemKeyspace.BootstrapState.COMPLETED);
            }
            else
                throw new ConfigurationException("This node was decommissioned and will not rejoin the ring unless cassandra.override_decommission=true has been set, or all existing data is removed and the node is bootstrapped again");
        }
        if (replacing && !(Boolean.parseBoolean(System.getProperty("cassandra.join_ring", "true"))))
            throw new ConfigurationException("Cannot set both join_ring=false and attempt to replace a node");
        if (DatabaseDescriptor.getReplaceTokens().size() > 0 || DatabaseDescriptor.getReplaceNode() != null)
            throw new RuntimeException("Replace method removed; use cassandra.replace_address instead");
        if (replacing)
        {
            if (SystemKeyspace.bootstrapComplete())
                throw new RuntimeException("Cannot replace address with a node that is already bootstrapped");
            if (!DatabaseDescriptor.isAutoBootstrap())
                throw new RuntimeException("Trying to replace_address with auto_bootstrap disabled will not work, check your configuration");
            bootstrapTokens = prepareReplacementInfo();
            appStates.put(ApplicationState.TOKENS, valueFactory.tokens(bootstrapTokens));
            appStates.put(ApplicationState.STATUS, valueFactory.hibernate(true));
        }
        else if (shouldBootstrap())
        {
            checkForEndpointCollision();
        }

        // have to start the gossip service before we can see any info on other nodes.  this is necessary
        // for bootstrap to get the load info it needs.
        // (we won't be part of the storage ring though until we add a counterId to our state, below.)
        // Seed the host ID-to-endpoint map with our own ID.
        UUID localHostId = SystemKeyspace.getLocalHostId();
        getTokenMetadata().updateHostId(localHostId, FBUtilities.getBroadcastAddress());
        appStates.put(ApplicationState.NET_VERSION, valueFactory.networkVersion());
        appStates.put(ApplicationState.HOST_ID, valueFactory.hostId(localHostId));
        appStates.put(ApplicationState.RPC_ADDRESS, valueFactory.rpcaddress(DatabaseDescriptor.getBroadcastRpcAddress()));
        appStates.put(ApplicationState.RELEASE_VERSION, valueFactory.releaseVersion());
        logger.info("Starting up server gossip");
        Gossiper.instance.register(this);
        Gossiper.instance.start(SystemKeyspace.incrementAndGetGeneration(), appStates); // needed for node-ring gathering.
        // gossip snitch infos (local DC and rack)
        gossipSnitchInfo();
        // gossip Schema.emptyVersion forcing immediate check for schema updates (see MigrationManager#maybeScheduleSchemaPull)
        Schema.instance.updateVersionAndAnnounce(); // Ensure we know our own actual Schema UUID in preparation for updates

        if (!MessagingService.instance().isListening())
            MessagingService.instance().listen();
        LoadBroadcaster.instance.startBroadcasting();

        HintsService.instance.startDispatch();
        BatchlogManager.instance.start();
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:62,代码来源:StorageService.java


注:本文中的org.apache.cassandra.config.DatabaseDescriptor.isAutoBootstrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。