public class BookKeeperAdmin extends Object
Constructor and Description |
---|
BookKeeperAdmin(BookKeeper bkc)
Constructor that takes in a BookKeeper instance .
|
BookKeeperAdmin(ClientConfiguration conf)
Constructor that takes in a configuration object so we know
how to connect to ZooKeeper to retrieve information about the BookKeeper
cluster.
|
BookKeeperAdmin(String zkServers)
Constructor that takes in a ZooKeeper servers connect string so we know
how to connect to ZooKeeper to retrieve information about the BookKeeper
cluster.
|
Modifier and Type | Method and Description |
---|---|
void |
asyncOpenLedger(long lId,
AsyncCallback.OpenCallback cb,
Object ctx)
Open a ledger as an administrator.
|
void |
asyncOpenLedgerNoRecovery(long lId,
AsyncCallback.OpenCallback cb,
Object ctx)
Open a ledger as an administrator without recovering the ledger.
|
void |
asyncRecoverBookieData(InetSocketAddress bookieSrc,
InetSocketAddress bookieDest,
AsyncCallback.RecoverCallback cb,
Object context)
Async method to rebuild and recover the ledger fragments data that was
stored on the source bookie.
|
void |
close()
Gracefully release resources that this client uses.
|
static boolean |
format(ClientConfiguration conf,
boolean isInteractive,
boolean force)
Format the BookKeeper metadata in zookeeper
|
LedgerHandle |
openLedger(long lId)
Open a ledger as an administrator.
|
LedgerHandle |
openLedgerNoRecovery(long lId)
Open a ledger as an administrator without recovering the ledger.
|
void |
recoverBookieData(InetSocketAddress bookieSrc,
InetSocketAddress bookieDest)
Synchronous method to rebuild and recover the ledger fragments data that
was stored on the source bookie.
|
void |
replicateLedgerFragment(LedgerHandle lh,
LedgerFragment ledgerFragment,
InetSocketAddress targetBookieAddress)
Replicate the Ledger fragment to target Bookie passed.
|
public BookKeeperAdmin(String zkServers) throws IOException, InterruptedException, org.apache.zookeeper.KeeperException
zkServers
- Comma separated list of hostname:port pairs for the ZooKeeper
servers cluster.IOException
- throws this exception if there is an error instantiating the
ZooKeeper client.InterruptedException
- Throws this exception if there is an error instantiating the
BookKeeper client.org.apache.zookeeper.KeeperException
- Throws this exception if there is an error instantiating the
BookKeeper client.public BookKeeperAdmin(ClientConfiguration conf) throws IOException, InterruptedException, org.apache.zookeeper.KeeperException
conf
- Client Configuration ObjectIOException
- throws this exception if there is an error instantiating the
ZooKeeper client.InterruptedException
- Throws this exception if there is an error instantiating the
BookKeeper client.org.apache.zookeeper.KeeperException
- Throws this exception if there is an error instantiating the
BookKeeper client.public BookKeeperAdmin(BookKeeper bkc)
bkc
- - bookkeeper instancepublic void close() throws InterruptedException, BKException
InterruptedException
- if there is an error shutting down the clients that this
class uses.BKException
public void asyncOpenLedger(long lId, AsyncCallback.OpenCallback cb, Object ctx)
lId
- ledger identifiercb
- Callback which will receive a LedgerHandle objectctx
- optional context object, to be passwd to the callback (can be null)BookKeeper.asyncOpenLedger(long, org.apache.bookkeeper.client.BookKeeper.DigestType, byte[], org.apache.bookkeeper.client.AsyncCallback.OpenCallback, java.lang.Object)
public LedgerHandle openLedger(long lId) throws InterruptedException, BKException
lId
- - ledger identifierInterruptedException
BKException
BookKeeper.openLedger(long, org.apache.bookkeeper.client.BookKeeper.DigestType, byte[])
public void asyncOpenLedgerNoRecovery(long lId, AsyncCallback.OpenCallback cb, Object ctx)
lId
- ledger identifiercb
- Callback which will receive a LedgerHandle objectctx
- optional context object, to be passwd to the callback (can be null)BookKeeper.asyncOpenLedgerNoRecovery(long, org.apache.bookkeeper.client.BookKeeper.DigestType, byte[], org.apache.bookkeeper.client.AsyncCallback.OpenCallback, java.lang.Object)
public LedgerHandle openLedgerNoRecovery(long lId) throws InterruptedException, BKException
lId
- ledger identifierInterruptedException
BKException
BookKeeper.openLedgerNoRecovery(long, org.apache.bookkeeper.client.BookKeeper.DigestType, byte[])
public void recoverBookieData(InetSocketAddress bookieSrc, InetSocketAddress bookieDest) throws InterruptedException, BKException
bookieSrc
- Source bookie that had a failure. We want to replicate the
ledger fragments that were stored there.bookieDest
- Optional destination bookie that if passed, we will copy all
of the ledger fragments from the source bookie over to it.InterruptedException
BKException
public void asyncRecoverBookieData(InetSocketAddress bookieSrc, InetSocketAddress bookieDest, AsyncCallback.RecoverCallback cb, Object context)
bookieSrc
- Source bookie that had a failure. We want to replicate the
ledger fragments that were stored there.bookieDest
- Optional destination bookie that if passed, we will copy all
of the ledger fragments from the source bookie over to it.cb
- RecoverCallback to invoke once all of the data on the dead
bookie has been recovered and replicated.context
- Context for the RecoverCallback to call.public void replicateLedgerFragment(LedgerHandle lh, LedgerFragment ledgerFragment, InetSocketAddress targetBookieAddress) throws InterruptedException, BKException
lh
- - ledgerHandleledgerFragment
- - LedgerFragment to replicatetargetBookieAddress
- - target Bookie, to where entries should be replicated.InterruptedException
BKException
public static boolean format(ClientConfiguration conf, boolean isInteractive, boolean force) throws Exception
isInteractive
- Whether format should ask prompt for confirmation if old data
exists or not.force
- If non interactive and force is true, then old data will be
removed without prompt.Exception
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.