java表复制_java 复制SDS表为一个新表

packagecom.huami.devops;importorg.slf4j.Logger;importorg.slf4j.LoggerFactory;importcom.xiaomi.infra.galaxy.sds.client.ClientFactory;importcom.xiaomi.infra.galaxy.sds.thrift.AdminService;importcom.xiaomi.infra.galaxy.sds.thrift.CommonConstants;importcom.xiaomi.infra.galaxy.sds.thrift.Credential;importcom.xiaomi.infra.galaxy.sds.thrift.ServiceException;importcom.xiaomi.infra.galaxy.sds.thrift.TableSpec;importcom.xiaomi.infra.galaxy.sds.thrift.UserType;importlibthrift091.TException;public classCopySDSTable {private staticClientFactory clientFactory;private staticAdminService.Iface adminClient;private static String secretKeyId = "";private static String secretKey = "";private static UserType userType =UserType.APP_SECRET;privateString endpoint;private static final Logger LOG = LoggerFactory.getLogger(CopySDSTable.class);private static String tableName = "srctable";private static String tableName1 = "tartable1";private static String tableName2 = "tartable-02";publicCopySDSTable(String endpoint){this.endpoint =endpoint;

init();

}private voidinit() {

Credential credential= newCredential().setSecretKey(secretKey).setSecretKeyId(secretKeyId).setType(userType);

clientFactory= newClientFactory().setCredential(credential);

adminClient= clientFactory.newAdminClient(endpoint + CommonConstants.ADMIN_SERVICE_PATH, 50000, 30000);

}private voidCopyTable(String OldTable,String NewTable){

TableSpec tableSpec= null;try{

tableSpec=adminClient.describeTable(OldTable);

LOG.debug("get tablespec.");

LOG.info("aaaaaaaaaaa");

}catch(TException e) {//TODO Auto-generated catch block

e.printStackTrace();

LOG.error(e.getMessage(), e.getCause());

}try{

adminClient.createTable(NewTable, tableSpec);

}catch(ServiceException e) {//TODO Auto-generated catch block

e.printStackTrace();

}catch(TException e) {//TODO Auto-generated catch block

e.printStackTrace();

LOG.error(e.getMessage(), e.getCause());

}

}public static voidmain(String[] args){

CopySDSTable ct= new CopySDSTable("https://awsbj0.sds.api.xiaomi.com");

ct.CopyTable(tableName, tableName1);

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值