写了一个从oracle导数据到hbase的多线程java程序,只要创建一个实体加上注解基本就可以导数据了

oracle多线程exp,oracle数据导入导出 一、exp/imp与expdp/impdp的区别1:把用户usera的对象导到用户userb,用法区别在于fromuser=usera touser=userb ,remap_schema='usera':'usera' 。例如imp system/passwd fromuser=usera touser=userb file=/oracle/exp.dmp log=/oracle/exp.log... 阅读详情

发布一个k8s部署视频:https://edu.youkuaiyun.com/course/detail/26967

课程内容:各种k8s部署方式。包括minikube部署,kubeadm部署,kubeasz部署,rancher部署,k3s部署。包括开发测试环境部署k8s,和生产环境部署k8s。

腾讯课堂连接地址https://ke.qq.com/course/478827?taid=4373109931462251&tuin=ba64518

第二个视频发布  https://edu.youkuaiyun.com/course/detail/27109

腾讯课堂连接地址https://ke.qq.com/course/484107?tuin=ba64518

介绍主要的k8s资源的使用配置和命令。包括configmap,pod,service,replicaset,namespace,deployment,daemonset,ingress,pv,pvc,sc,role,rolebinding,clusterrole,clusterrolebinding,secret,serviceaccount,statefulset,job,cronjob,podDisruptionbudget,podSecurityPolicy,networkPolicy,resourceQuota,limitrange,endpoint,event,conponentstatus,node,apiservice,controllerRevision等。

第三个视频发布:https://edu.youkuaiyun.com/course/detail/27574

详细介绍helm命令,学习helm chart语法,编写helm chart。深入分析各项目源码,学习编写helm插件


————————————————------------------------------------------------------------------------------------------------------------------

三个注解类:

 

@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Column {
	String family() ;
	String column() default "";
	String oracle_column() default "";
}

 

@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface RowKey {

}

 

@Target({ElementType.TYPE}) 
@Retention(RetentionPolicy.RUNTIME)
public @interface Table {
	String oracle_name()default "";
	String hbase_name() default "";
}

实体类根据你的需求而创建,有两个基本实体类

 

 

public class BaseEntity {
	public boolean isEmpty(){
		return false;
	}
}
public class RetryEntity {
	private String oracleTableName;
	private String hbaseTableName;
	private int startIndex;
	private int endIndex;

	public String getOracleTableName() {
		return oracleTableName;
	}

	public void setOracleTableName(String oracleTableName) {
		this.oracleTableName = oracleTableName;
	}

	public String getHbaseTableName() {
		return hbaseTableName;
	}

	public void setHbaseTableName(String hbaseTableName) {
		this.hbaseTableName = hbaseTableName;
	}

	public int getStartIndex() {
		return startIndex;
	}

	public void setStartIndex(int startIndex) {
		this.startIndex = startIndex;
	}

	public int getEndIndex() {
		return endIndex;
	}

	public void setEndIndex(int endIndex) {
		this.endIndex = endIndex;
	}

	

}

一个简单的例子:

 

 

@Table(hbase_name = "CreditReport", oracle_name = "TT_CREDIT_REPORT")
public class CreditReport extends BaseEntity {
	@RowKey
	@Column(family = "CreditReport", column = "", oracle_column = "BIZGUID")
	private String bizguid;
	@Column(family = "CreditReport", column = "", oracle_column = "PATH")
	private String path;
	@Column(family = "CreditReport", column = "", oracle_column = "STATUS")
	private int status;
	@Column(family = "CreditReport", column = "", oracle_column = "ERRORMSG")
	private String errormsg;
	@Column(family = "CreditReport", column = "", oracle_column = "DOCID")
	private String docid;
	@Column(family = "CreditReport", column = "", oracle_column = "FILEID")
	private String fileid;
	@Column(family = "CreditReport", column = "", oracle_column = "LASTCHGDTS")
	private Date lastchgdts;
	@Column(family = "CreditReport", column = "", oracle_column = "CATEGORY")
	private String category;
	@Column(family = "CreditReport", column = "", oracle_column = "FILENAME")
	private String filename;
	@Column(family = "CreditReport", column = "", oracle_column = "FILEINDEX")
	private int fileindex;

	public String getBizguid() {
		return bizguid;
	}

	public void setBizguid(String bizguid) {
		this.bizguid = bizguid;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getErrormsg() {
		return errormsg;
	}

	public void setErrormsg(String errormsg) {
		this.errormsg = errormsg;
	}

	public String getDocid() {
		return docid;
	}

	public void setDocid(String docid) {
		this.docid = docid;
	}

	public String getFileid() {
		return fileid;
	}

	public void setFileid(String fileid) {
		this.fileid = fileid;
	}

	public Date getLastchgdts() {
		return lastchgdts;
	}

	public void setLastchgdts(Date lastchgdts) {
		this.lastchgdts = lastchgdts;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public String getFilename() {
		return filename;
	}

	public void setFilename(String filename) {
		this.filename = filename;
	}

	public int getFileindex() {
		return fileindex;
	}

	public void setFileindex(int fileindex) {
		this.fileindex = fileindex;
	}

}

 

public class EmptyEntity extends BaseEntity {

	@Override
	public boolean isEmpty() {
		return true;
	}
	
}

队列:

 

 

public class RecordQueue {
	private static BlockingQueue<BaseEntity> queue=null;
	
	public RecordQueue(){
		queue=new LinkedBlockingQueue<BaseEntity>(1000000);
	}
	
	public RecordQueue(int capacity){
		queue=new LinkedBlockingQueue<BaseEntity>(capacity);
	}
	
	public  BaseEntity getValue() throws InterruptedException{
		return queue.take();
	}
	
	public boolean isEmpty(){
		return queue.isEmpty();
	}
	
	public  void putValue(BaseEntity value) throws InterruptedException{
		queue.put(value);
	}
	
	public void putValues(List<BaseEntity> values) throws InterruptedException{
		for(BaseEntity obj:values){
			this.putValue(obj);
		}
	}
}

失败队列:

 

 

public class PartErrorRetryQueue {
	private static BlockingQueue<RetryEntity> queue=null;
	private AtomicBoolean retryThreadStarted=new AtomicBoolean(false);
	
	public PartErrorRetryQueue(){
		queue=new LinkedBlockingQueue<RetryEntity>(1000000);
	}
	
	public PartErrorRetryQueue(int capacity){
		queue=new LinkedBlockingQueue<RetryEntity>(capacity);
	}
	
	public boolean isEmpty(){
		return queue.isEmpty();
	}
	
	public  void putValue(RetryEntity value) throws InterruptedException{
		queue.put(value);
	}
	
	public void putValues(List<RetryEntity> values) throws InterruptedException{
		for(RetryEntity obj:values){
			this.putValue(obj);
		}
	}
	
	public void startRetryThread(){
		if(!retryThreadStarted.getAndSet(true)){
			new RetryThread().start();
		}
	}
	
	
	private class RetryThread extends Thread{
		
		@Override
		public void run() {
			while(true){
				try {
					int getConnTimes=0;
					ConnectionEntity connEntity=null;
					try {
						getConnTimes++;
						connEntity=ConnectionPool.getInstance().getConnection();
					} catch (SQLException e) {
						e.printStackTrace();
						while(connEntity==null){
							try {
								if(getConnTimes>10){
									Thread.currentThread().interrupt();
									throw new RuntimeException("get connection times exceeded");
								}
								getConnTimes++;
								connEntity=ConnectionPool.getInstance().getConnection();
							} catch (SQLException e1) {
								e1.printStackTrace();
							}
						}
					}
					
					RetryEntity entity=queue.take();
					
					Connection conn=connEntity.getConnection();
					List<String> columns=OracleUtils.getTableColumns(conn,entity.getOracleTableName());
					
					ResultSet rs=null;
					PreparedStatement statement=null;
					try{
						statement=conn.prepareStatement("select * from (select rownum rn,t.* from "+entity.getOracleTableName()+" t where rownum < ? )t where t.rn >= ?");
						statement.setInt(1,entity.getEndIndex() );
						statement.setInt(2, entity.getStartIndex());
						rs=statement.executeQuery();
						List<BaseEntity> entityList=OracleUtils.convertResultSetToEntity(rs,columns, entity.getOracleTableName());
						HBaseUtils.getInstance().batchInsertRecord(entity.getHbaseTableName(), entityList);
					} catch (Exception e) {
						queue.put(entity);
						e.printStackTrace();
					}finally{
						OracleUtils.closeResultSet(rs);
						OracleUtils.closePrepareStatement(statement);
					}
				
				} catch (InterruptedException e) {
					e.printStackTrace();
					throw new RuntimeException("get connection times exceeded");
					
				}
			}
		}
		
	}
}


hbase单表单线程处理:

 

public class HBaseOutgoingWorkThread extends Thread {
	private RecordQueue queue;
	private int batchSize;
	private String tableName;
	private int totalCount;
	private BackendThread backendThread;
	public HBaseOutgoingWorkThread(RecordQueue queue,int batchSize,String tableName,int totalCount){
		this.queue=queue;
		this.batchSize=batchSize;
		this.tableName=tableName;
		this.totalCount=totalCount;
		backendThread=new BackendThread();
		backendThread.start();
	}
	
	@Override
	public void run() {
		try {
			int currCount=0;
			while(true){
				int count=0;
				List<BaseEntity> entityList=new ArrayList<BaseEntity>();
				while(true){
					BaseEntity obj=queue.getValue();
					count++;
					if(!obj.isEmpty()){
						entityList.add(obj);
						currCount++;
					}
					if(count==batchSize){
						break;
					}
				}
				HBaseUtils.getInstance().batchInsertRecord(tableName, entityList);
				if(totalCount==currCount){
					HBaseUtils.closeConnection();
					ConnectionPool.getInstance().shutdown();
					backendThread.interrupt();
					break;
				}
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	
	class BackendThread extends Thread{
		@Override
		public void run() {
			try {
				while(true){
					boolean firstEmpty=queue.isEmpty();
					Thread.sleep(100000);
					boolean secondEmpty=queue.isEmpty();
					
					if(firstEmpty&&secondEmpty){
						for(int i=0;i<batchSize;i++){
							try {
								queue.putValue(new EmptyEntity());
							} catch (InterruptedException e) {
								e.printStackTrace();
							}
						}
					}
				}
			} catch (InterruptedException e) {
				System.out.println("InterruptedException");
				e.printStackTrace();
			}
		}
	} 
}

hbase单表多现场,基于CountDownLatch:

 

 

public class HBaseOutgoingWorkThreadUseCountDownLatch extends Thread {
	private RecordQueue queue;
	private int batchSize;
	private String tableName;
	private CountDownLatch latch;
	private int totalCount;
	private BackendThread backendThread;
	public HBaseOutgoingWorkThreadUseCountDownLatch(RecordQueue queue,int batchSize,String tableName,CountDownLatch latch,int totalCount){
		this.queue=queue;
		this.batchSize=batchSize;
		this.tableName=tableName;
		this.latch=latch;
		this.totalCount=totalCount;
		backendThread=new BackendThread();
		backendThread.start();
	}
	
	@Override
	public void run() {
		try {
			int currentCount=0;
			while(true){
				int count=0;
				List<BaseEntity> entityList=new ArrayList<BaseEntity>();
				while(true){
					BaseEntity obj=queue.getValue();
					count++;
					if(!obj.isEmpty()){
						entityList.add(obj);
						currentCount++;
					}
					if(count==batchSize){
						System.out.println(currentCount);
						break;
					}
				}
				HBaseUtils.getInstance().batchInsertRecord(tableName, entityList);
				if(totalCount==currentCount){
					System.out.println(currentCount);
					backendThread.interrupt();
					break;
				}
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}finally{
			latch.countDown();
		}
	}
	
	class BackendThread extends Thread{
		@Override
		public void run() {
			try {
				while(true){
					boolean firstEmpty=queue.isEmpty();
					Thread.sleep(100000);	
					boolean secondEmpty=queue.isEmpty();
					
					if(firstEmpty&&secondEmpty){
						for(int i=0;i<batchSize;i++){
							try {
								queue.putValue(new EmptyEntity());
							} catch (InterruptedException e) {
								e.printStackTrace();
							}
						}
					}
				}
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	} 
}


Oracle拉取数据单线程:

 

 

public class OracleIncomeWorkThread extends Thread {
	private String tableName;
	private RecordQueue queue;
	private int batchSize;
	private int start;
	private int end;
	
	public OracleIncomeWorkThread(String tableName,RecordQueue queue,int batchSize,int start,int end){
		this.tableName=tableName;
		this.queue=queue;
		this.batchSize=batchSize;
		this.start=start;
		this.end=end;
	}
	
	@Override
	public void run() {
		if(start>end){
			return;
		}
		ConnectionPool pool=null;
		ConnectionEntity entity=null;
		try {
			pool=ConnectionPool.getInstance();
			entity=pool.getConnection();
			Connection conn=entity.getConnection();
			List<String> columns=OracleUtils.getTableColumns(conn,tableName);
			int count=0;
			do{
				ResultSet rs=null;
				PreparedStatement statement=null;
				try{
					if((start+batchSize*(count+1))>end){
						batchSize=end-(start+batchSize*count)+1;
					}
					statement=conn.prepareStatement("select * from (select rownum rn,t.* from "+tableName+" t where rownum < ? )t where t.rn >= ?");
					statement.setInt(1, start+batchSize);
					statement.setInt(2, start);
					rs=statement.executeQuery();
					List<BaseEntity> list=OracleUtils.convertResultSetToEntity(rs,columns, tableName);
					queue.putValues(list);
					start+=batchSize;
				}catch(Exception e){
					e.printStackTrace();
				}finally{
					OracleUtils.closeResultSet(rs);
					OracleUtils.closePrepareStatement(statement);
				}
			}while((start+batchSize*count)<end);
		} catch (InterruptedException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}finally{
			try {
				pool.releaseConnection(entity.getId());
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
	}
}


oracle拉取数据多线程:

 

 

public class OracleIncomeWorkThreadUseCountDownLatch extends Thread {
	private String tableName;
	private RecordQueue queue;
	private int batchSize;
	private int start;
	private int end;
	private CountDownLatch latch;
	
	public OracleIncomeWorkThreadUseCountDownLatch(String tableName,RecordQueue queue,int batchSize,int start,int end,CountDownLatch latch){
		this.tableName=tableName;
		this.queue=queue;
		this.batchSize=batchSize;
		this.start=start;
		this.end=end;
		this.latch=latch;
	}
	
	@Override
	public void run() {
		if(start>end){
			return;
		}
		ConnectionPool pool=null;
		ConnectionEntity entity=null;
		
		try {
			pool=ConnectionPool.getInstance();
			entity=pool.getConnection();
			Connection conn=entity.getConnection();
			List<String> columns=OracleUtils.getTableColumns(conn,tableName);
			int count=0;
			do{
				ResultSet rs=null;
				PreparedStatement statement=null;
				try{
					if((start+batchSize*(count+1))>end){
						batchSize=end-(start+batchSize*count)+1;
					}
					statement=conn.prepareStatement("select * from (select rownum rn,t.* from "+tableName+" t where rownum < ? )t where t.rn >= ?");
					statement.setInt(1, start+batchSize);
					statement.setInt(2, start);
					rs=statement.executeQuery();
					List<BaseEntity> list=OracleUtils.convertResultSetToEntity(rs, columns, tableName);
					queue.putValues(list);
					start+=batchSize;
				}catch(Exception e){
					e.printStackTrace();
				}finally{
					OracleUtils.closeResultSet(rs);
					OracleUtils.closePrepareStatement(statement);
				}
			}while((start+batchSize*count)<end);
		} catch (InterruptedException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
		}finally{
			try {
				pool.releaseConnection(entity.getId());
			} catch (SQLException e) {
				e.printStackTrace();
			}
			latch.countDown();
		}
	}
}


一个入口程序例子:

 

 

public class CreditReportEnteranceUseCountDownLatch implements Enterance {
	private ExecutorService executeService;
	//每次从oracle查询数据的每页数量
	private int pageSize;
	//每一批的线程数
	private int threadCountBatch;
	//每线程梳理记录数量
	private int countPerThread;
	public CreditReportEnteranceUseCountDownLatch(ExecutorService executeService,int pageSize,int threadCountBatch,int countPerThread){
		this.executeService=executeService;
		this.pageSize=pageSize;
		this.threadCountBatch=threadCountBatch;
		this.countPerThread=countPerThread;
	}
	public void doWork() throws Exception {
		HBaseUtils.getInstance().deleteTable("CreditReport");
		HBaseUtils.getInstance().createTableFromEntity(CreditReport.class);
		long count=OracleUtils.getRecordCount("TT_CREDIT_REPORT");
		//总共需要线程数
		int threadCount=(int)Math.ceil(count*1.0/countPerThread);
		
		int start=1;
		//总共需要线程数小于设定的每批线程数
		if(threadCount<=threadCountBatch){
			CountDownLatch latch=new CountDownLatch(threadCount*2);
			for(int i=0;i<threadCount;i++){
				//每一对线程一个队列,这理也可以多个线程一个队列看具体效率
				RecordQueue queue=new RecordQueue(pageSize);
				int end=start+countPerThread;
				if(count<end){
					end=(int)count+1;
				}
				OracleIncomeWorkThreadUseCountDownLatch oracleThread=new OracleIncomeWorkThreadUseCountDownLatch("TT_CREDIT_REPORT", queue, pageSize, start, end,latch);
				executeService.submit(oracleThread);
				HBaseOutgoingWorkThreadUseCountDownLatch hbaseThread=new HBaseOutgoingWorkThreadUseCountDownLatch(queue, pageSize/2, "CreditReport",latch,end-start);
				executeService.submit(hbaseThread);
				start+=countPerThread;
			}
			latch.await();
		}else{
			//线程批次
			int threadBatch=(int)Math.ceil(threadCount*1.0/threadCountBatch);
			start=1;
			if(threadCount%threadCountBatch==0){
				for(int j=0;j<threadBatch;j++){
					CountDownLatch latch=new CountDownLatch(threadCountBatch*2);
					for(int i=0;i<threadCountBatch;i++){
						RecordQueue queue=new RecordQueue(pageSize);
						int end=start+countPerThread;
						if(count<end){
							end=(int)count+1;
						}
						OracleIncomeWorkThreadUseCountDownLatch oracleThread=new OracleIncomeWorkThreadUseCountDownLatch("TT_CREDIT_REPORT", queue, pageSize, start, end,latch);
						executeService.submit(oracleThread);
						HBaseOutgoingWorkThreadUseCountDownLatch hbaseThread=new HBaseOutgoingWorkThreadUseCountDownLatch(queue, pageSize/2, "CreditReport",latch,end-start);
						executeService.submit(hbaseThread);
						start+=countPerThread;
					}
					latch.await();
				}
			}else{
				for(int j=0;j<threadBatch-1;j++){
					CountDownLatch latch=new CountDownLatch(threadCountBatch*2);
					for(int i=0;i<threadCountBatch;i++){
						RecordQueue queue=new RecordQueue(pageSize);
						int end=start+countPerThread;
						if(count<end){
							end=(int)count+1;
						}
						OracleIncomeWorkThreadUseCountDownLatch oracleThread=new OracleIncomeWorkThreadUseCountDownLatch("TT_CREDIT_REPORT", queue, pageSize, start, end,latch);
						executeService.submit(oracleThread);
						HBaseOutgoingWorkThreadUseCountDownLatch hbaseThread=new HBaseOutgoingWorkThreadUseCountDownLatch(queue, pageSize/2, "CreditReport",latch,end-start);
						executeService.submit(hbaseThread);
						start+=countPerThread;
					}
					latch.await();
				}
				
				int restCount=threadCount-(threadBatch-1)*threadCountBatch;
				CountDownLatch latch=new CountDownLatch(restCount*2);
				for(int i=0;i<restCount;i++){
					RecordQueue queue=new RecordQueue(pageSize);
					int end=start+countPerThread;
					if(count<end){
						end=(int)count+1;
					}
					OracleIncomeWorkThreadUseCountDownLatch oracleThread=new OracleIncomeWorkThreadUseCountDownLatch("TT_CREDIT_REPORT", queue, pageSize, start, end,latch);
					executeService.submit(oracleThread);
					HBaseOutgoingWorkThreadUseCountDownLatch hbaseThread=new HBaseOutgoingWorkThreadUseCountDownLatch(queue, pageSize/2, "CreditReport",latch,end-start);
					executeService.submit(hbaseThread);
					start+=countPerThread;
				}
				latch.await();
			}
		}
		
		ConnectionPool.getInstance().shutdown();
		HBaseUtils.closeConnection();
	}

}


工具类:

 

oracle连接池:

 

public class ConnectionPool {
	private static  ConcurrentHashMap<String,ConnectionEntity> idelConnections=null;
	private static  ConcurrentHashMap<String,ConnectionEntity> activeConnections=null;
	private static int initSize;
	private static int maxSize;
	private static AtomicInteger idelSize=new AtomicInteger(0);
	private static AtomicInteger activeSize=new AtomicInteger(0);
	private static ConnectionPool instance=null;
	private static Lock lock= new ReentrantLock();
	private  Object object=new Object();
	private static boolean isShutdown=false;
	 
	private ConnectionPool(int initSize,int maxSize){
		this.initSize=initSize;
		this.maxSize=maxSize;
		idelConnections=new ConcurrentHashMap<String,ConnectionEntity>();
		activeConnections=new ConcurrentHashMap<String,ConnectionEntity>();
		initConnections();
		new DetectFailConnection().start();
	}
	
	public  ConnectionEntity getConnection() throws InterruptedException, SQLException{
		if(isShutdown){
			throw new RuntimeException("pool is shutdown.");
		}
	    lock.lock();
	    try{
			if(idelSize.get()>0){
				if(idelConnections.size()<=0){
					throw new RuntimeException("");
				}
				String key=idelConnections.entrySet().iterator().next().getKey();
				ConnectionEntity entity=idelConnections.entrySet().iterator().next().getValue();
				entity.setStatus(Connection_Status.active);
				idelConnections.remove(key);				
				idelSize.decrementAndGet();
				if(entity.getConnection().isClosed()){
					return getConnection();
				}
				activeConnections.put(key, entity);
				activeSize.incrementAndGet();
				return entity;
			}
	    }finally{
	    	lock.unlock();
	    }
	    
	    if(activeSize.get()>maxSize){
	    	throw new RuntimeException("活跃数量大于最大值");
	    }
	    if(activeSize.get()==maxSize){
	    	synchronized (object) {
	    		object.wait();
			}
	    	
	    }
	    
	    if(isShutdown){
	    	throw new RuntimeException("pool is shutdown.");
	    }
	    
	    Connection conn=OracleUtils.getConnection();
	    String id=UUID.randomUUID().toString();
	    ConnectionEntity entity=new ConnectionEntity();
	    entity.setId(id);
	    entity.setConnection(conn);
	    entity.setStatus(Connection_Status.active);
	    activeConnections.put(id, entity);
	    activeSize.incrementAndGet();
	    return entity;
	}
	
	
	
	public  void releaseConnection(String id) throws SQLException{
		if(isShutdown){
			throw new RuntimeException("pool is shutdown.");
		}
		if(idelSize.get()==maxSize){
			OracleUtils.closeConnection(activeConnections.remove(id).getConnection());
		}else{
			ConnectionEntity entity=activeConnections.remove(id);
			entity.setStatus(Connection_Status.idel);
			idelConnections.put(id, entity);
			idelSize.incrementAndGet();
			activeSize.decrementAndGet();
			synchronized (object) {
				object.notify();
			}
			
		}
	}
	
	private void initConnections(){
		for(int i=0;i<this.initSize;i++){
			ConnectionEntity entity=new ConnectionEntity();
			String id=UUID.randomUUID().toString();
			entity.setId(id);
			entity.setConnection(OracleUtils.getConnection());
			entity.setStatus(Connection_Status.idel);
			idelConnections.put(id, entity);
			idelSize.getAndAdd(1);
		}
	}
	
	public void shutdown(){
		isShutdown=true;
		synchronized (object) {
			object.notifyAll();
		}
		Iterator<String> idelIt=idelConnections.keySet().iterator();
		while(idelIt.hasNext()){
			String key=idelIt.next();
			ConnectionEntity entity=idelConnections.get(key);
			try {
				entity.getConnection().close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		Iterator<String>activeIt=activeConnections.keySet().iterator();
		while(activeIt.hasNext()){
			String key=activeIt.next();
			ConnectionEntity entity=activeConnections.get(key);
			try {
				entity.getConnection().close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		 initSize=0;
		 maxSize=0;
		 idelSize=new AtomicInteger(0);
		 activeSize=new AtomicInteger(0);
	}
	
	public int getIdelSize(){
		return this.idelSize.get();
	}
	
	public int getActiveSize(){
		return this.activeSize.get();
	}
	
	public static ConnectionPool getInstance(){
		if(isShutdown){
			throw new RuntimeException("pool is already shutdown.");
		}
		if(maxSize>0){
			return instance;
		}
		return getInstance(10,30);
	}
	public static ConnectionPool getInstance(int initSize,int maxSize){
		if(isShutdown){
			throw new RuntimeException("pool is already shutdown.");
		}
		if(initSize<0||maxSize<1){
			throw new RuntimeException("initSize必须不小于0,maxsize必须大于等于1");
		}
		if(initSize>maxSize){
			initSize=maxSize;
		}
		synchronized (ConnectionPool.class) {
			if(instance==null){
				instance=new ConnectionPool(initSize,maxSize);
			}
		}
		return instance;
	}
	
	public  static class ConnectionEntity{
		private String id;
		private Connection connection;
		private Connection_Status status;
		
		public Connection getConnection() {
			return connection;
		}
		public void setConnection(Connection connection) {
			this.connection = connection;
		}
		public Connection_Status getStatus() {
			return status;
		}
		public void setStatus(Connection_Status status) {
			this.status = status;
		}
		public String getId() {
			return id;
		}
		public void setId(String id) {
			this.id = id;
		}
		
		
		
	}
	
	private enum Connection_Status{
		idel,active,close
	}
	
	class DetectFailConnection extends Thread{
		@Override
		public void run() {
			Iterator<String> itIdel=idelConnections.keySet().iterator();
			while(itIdel.hasNext()){
				String key =itIdel.next();
				ConnectionEntity entity=idelConnections.get(key);
				try {
					if(entity.getConnection().isClosed()){
						idelConnections.remove(key);
						idelSize.decrementAndGet();
					}
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
			
			Iterator<String> itActive=activeConnections.keySet().iterator();
			while(itActive.hasNext()){
				String key=itActive.next();
				ConnectionEntity entity=activeConnections.get(key);
				try {
					if(entity.getConnection().isClosed()){
						activeConnections.remove(key);
						activeSize.decrementAndGet();
					}
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
			try {
				Thread.sleep(10000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}

 


反射工具:

 

 

 

public class EntityUtils {
	private static final String basePackage="com.topcheer.transfer.entity";
	public static Class getEntityByOracleTableName(String tableName){
		List<Class> allClass = getClasses(basePackage);
		return filterOracleEntity(allClass,tableName);
	}
	
	/*public static void main(String[] args) {
		Class c=getEntityByOracleTableName("Test");
		System.out.println(c.getName().substring(c.getName().lastIndexOf(".")+1));
	}*/
	private static Class filterOracleEntity(List<Class> allClass,String tableName){
		for(Class c:allClass){
			if(c.isAnnotationPresent(Table.class)){
				Table ann=(Table) c.getAnnotation(Table.class);
				if(ann.oracle_name().equals(tableName)){
					return c;
				}else if(ann.oracle_name().equals("")&&c.getName().substring(c.getName().lastIndexOf(".")+1).equals(tableName)){
					return c;
				}
			}
		}
		throw new RuntimeException("table entity not found");
	}
	/** 
     * 从包package中获取所有的Class 
     * @param pack 
     * @return 
     */  
    private static List<Class> getClasses(String packageName){  
          
        //第一个class类的集合  
        List<Class> classes = new ArrayList<Class>();  
        //是否循环迭代  
        boolean recursive = true;  
        //获取包的名字 并进行替换  
        String packageDirName = packageName.replace('.', '/');  
        //定义一个枚举的集合 并进行循环来处理这个目录下的things  
        Enumeration<URL> dirs;  
        try {  
            dirs = Thread.currentThread().getContextClassLoader().getResources(packageDirName);  
            //循环迭代下去  
            while (dirs.hasMoreElements()){  
                //获取下一个元素  
                URL url = dirs.nextElement();  
                //得到协议的名称  
                String protocol = url.getProtocol();  
                //如果是以文件的形式保存在服务器上  
                if ("file".equals(protocol)) {  
                    //获取包的物理路径  
                    String filePath = URLDecoder.decode(url.getFile(), "UTF-8");  
                    //以文件的方式扫描整个包下的文件 并添加到集合中  
                    findAndAddClassesInPackageByFile(packageName, filePath, recursive, classes);  
                }  
            }  
        } catch (IOException e) {  
            e.printStackTrace();  
        }  
         
        return classes;  
    }  
    
    /** 
     * 以文件的形式来获取包下的所有Class 
     * @param packageName 
     * @param packagePath 
     * @param recursive 
     * @param classes 
     */  
    private static void findAndAddClassesInPackageByFile(String packageName, String packagePath, final boolean recursive, List<Class> classes){  
        //获取此包的目录 建立一个File  
        File dir = new File(packagePath);  
        //如果不存在或者 也不是目录就直接返回  
        if (!dir.exists() || !dir.isDirectory()) {  
            return;  
        }  
        //如果存在 就获取包下的所有文件 包括目录  
        File[] dirfiles = dir.listFiles(new FileFilter() {  
        //自定义过滤规则 如果可以循环(包含子目录) 或则是以.class结尾的文件(编译好的java类文件)  
              public boolean accept(File file) {  
                return (recursive && file.isDirectory()) || (file.getName().endsWith(".class"));  
              }  
            });  
        //循环所有文件  
        for (File file : dirfiles) {  
            //如果是目录 则继续扫描  
            if (file.isDirectory()) {  
                findAndAddClassesInPackageByFile(packageName + "." + file.getName(),  
                                      file.getAbsolutePath(),  
                                      recursive,  
                                      classes);  
            }  
            else {  
                //如果是java类文件 去掉后面的.class 只留下类名  
                String className = file.getName().substring(0, file.getName().length() - 6);  
                try {  
                    //添加到集合中去  
                    classes.add(Class.forName(packageName + '.' + className));  
                } catch (ClassNotFoundException e) {  
                    e.printStackTrace();  
                }  
            }  
        }  
    }  

}


hbase工具类:

 

 

public class HBaseUtils {
	 private static Configuration conf = HBaseConfiguration.create();
	 private static ExecutorService poolx=Executors.newScheduledThreadPool(20);
	 private static Connection connection = null;
	 private static HBaseUtils instance=null;
	 
	 private HBaseUtils(){
		 if(connection==null){
			 try {
				connection=ConnectionFactory.createConnection(conf, poolx);
			} catch (IOException e) {
				e.printStackTrace();
			}
		 }
	 }
	 
	 public static void closeConnection(){
		 try {
			connection.close();
			poolx.shutdownNow();
		} catch (IOException e) {
			e.printStackTrace();
		}
	 }
	 
	 public static synchronized HBaseUtils getInstance(){
		 if(instance==null){
			 instance=new HBaseUtils();
		 }
		 return instance;
	 }
	  /**
     * 创建表
     * @throws IOException
     */
    public void createTable(String tableName, String[] columns) throws IOException {
        Admin admin = connection.getAdmin();
        TableName name=TableName.valueOf(tableName);
        if (admin.tableExists(name)) {
        	admin.disableTable(name);
        	admin.deleteTable(name);
        } else {
            HTableDescriptor desc =new HTableDescriptor();
            desc.setName(TableName.valueOf(tableName));
            for (String column : columns) {
                desc.addFamily(new HColumnDescriptor(column));
            }
            admin.createTable(desc);
        }
    }
    
    public void createTableFromEntity(Class entityClass){
    	com.topcheer.transfer.annotation.Table ann=(com.topcheer.transfer.annotation.Table)entityClass.getAnnotation(com.topcheer.transfer.annotation.Table.class);
    	String hbase_name=ann.hbase_name();
    	if(hbase_name.equals("")){
    		hbase_name=entityClass.getName();
    	}
    	Field[]fields=entityClass.getDeclaredFields();
    	Set<String> fimalySet=new HashSet<String>();
    	for(Field field:fields){
    		Column column=field.getAnnotation(Column.class);
    		fimalySet.add(column.family());
    	}
    	String [] familys=fimalySet.toArray(new String[]{});
    	try {
			createTable(hbase_name,familys);
		} catch (IOException e) {
			e.printStackTrace();
		}
    }
    
    
    /**
     * 插入一行记录
     * @param tablename
     *             表名
     * @param row
     *             行名称
     * @param columnFamily
     *             列族名
     * @param columns
     *             (列族名:column)组合成列名
     * @param values
     *             行与列确定的值
     */
    public void insertRecord(String tableName, String row, String columnFamily, String[] columns, String[] values) {
        try {
        	TableName name=TableName.valueOf(tableName);
            Table table = connection.getTable(name);
            Put put = new Put(Bytes.toBytes(row));
            for (int i = 0; i < columns.length; i++) {
                put.addColumn(Bytes.toBytes(columnFamily),
                        Bytes.toBytes(String.valueOf(columns[i])),
                        Bytes.toBytes(values[i]));
                table.put(put);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    
    /**
     * 將对象转化为Put
     * @param obj
     * @return
     * @throws IllegalAccessException 
     * @throws IllegalArgumentException 
     */
    private Put convertEntityToPut(BaseEntity obj) throws IllegalArgumentException, IllegalAccessException{
    	Field[]fields=obj.getClass().getDeclaredFields();
    	Field rowKeyField=null;
    	for(Field field:fields){
    		if(field.isAnnotationPresent(RowKey.class)){
    			rowKeyField=field;
    			rowKeyField.setAccessible(true);
    		}
    	}
    	if(rowKeyField==null){
    		throw new RuntimeException("rowKey注解不存在");
    	}
    	Put p = new Put(Bytes.toBytes(String.valueOf(rowKeyField.get(obj))));
    	for(Field field:fields){
    		if(field!=rowKeyField){
    			Column column=field.getAnnotation(Column.class);
    			String family=column.family();
    			String col=column.column();
    			if(col.equals("")){
    				col=field.getName();
    			}
    			field.setAccessible(true);
    			Object value=field.get(obj);
    			p.addColumn(Bytes.toBytes(family), Bytes.toBytes(col), Bytes.toBytes(String.valueOf(value)));
    		}
    	}
        
        return p;
    }
    
    /**
     * 批量插入
     * @param tableName
     * @param entityList
     */
    public void batchInsertRecord(String tableName,List<BaseEntity> entityList){
        	BufferedMutator table=null;
			try {
				table = connection.getBufferedMutator(TableName.valueOf(tableName));
				List<Mutation> mutations = new ArrayList<Mutation>();
	            for(BaseEntity entity:entityList){
	            	mutations.add(convertEntityToPut(entity));
	            }
	            table.mutate(mutations);
	            table.flush();
			} catch (IOException e) {
				e.printStackTrace();
			} catch (IllegalArgumentException e) {
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				e.printStackTrace();
			}
    }
    
    /**
     * 删除一行记录
     * @param tablename
     *             表名
     * @param rowkey
     *             行名
     * @throws IOException
     */
    public void deleteRow(String tablename, String rowkey) throws IOException {
    	TableName name=TableName.valueOf(tablename);
        Table table = connection.getTable(name);
        List<Delete> list = new ArrayList<Delete>();
        Delete d1 = new Delete(rowkey.getBytes());
        list.add(d1);
        table.delete(list);
    }
    
    /**
     * 查找一行记录
     * @param tablename
     *             表名
     * @param rowkey
     *             行名
     */
    public static void selectRow(String tablename, String rowKey)
            throws IOException {
    	TableName name=TableName.valueOf(tablename);
        Table table = connection.getTable(name);
        Get g = new Get(rowKey.getBytes());
        Result rs = table.get(g);
        for (Cell cell : rs.rawCells()) {
            System.out.print(new String(cell.getRowArray()) + "  ");
            System.out.print(new String(cell.getFamilyArray()) + ":");
            System.out.print(new String(cell.getQualifierArray()) + "  ");
            System.out.print(cell.getTimestamp() + "  ");
            System.out.println(new String(cell.getValueArray()));
        }
    }
    
    /**
     * 查询表中所有行
     * @param tablename
     */
    public void scanAllRecord(String tablename) {
        try {
        	TableName name=TableName.valueOf(tablename);
            Table table = connection.getTable(name);
            Scan s = new Scan();
            ResultScanner rs = table.getScanner(s);
            for(Result result : rs){
	            for (Cell cell : result.rawCells()) {
	                System.out.print(new String(cell.getRowArray()) + "  ");
	                System.out.print(new String(cell.getFamilyArray()) + ":");
	                System.out.print(new String(cell.getQualifierArray()) + "  ");
	                System.out.print(cell.getTimestamp() + "  ");
	                System.out.println(new String(cell.getValueArray()));
	            }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    
    /**
     * 删除表操作
     * @param tablename
     * @throws IOException
     */
    public void deleteTable(String tablename) throws IOException {
        try {
        	TableName name=TableName.valueOf(tablename);
            Admin admin = connection.getAdmin();
            if(admin.tableExists(name)){
            	admin.disableTable(name);
            	admin.deleteTable(name);
            }
        } catch (MasterNotRunningException e) {
            e.printStackTrace();
        } catch (ZooKeeperConnectionException e) {
            e.printStackTrace();
        }
    }
}

oracle工具类:

public class OracleUtils {
	static{
		try {
			Class.forName("oracle.jdbc.driver.OracleDriver");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
	}
	public static Connection getConnection()  {
		
		int i=0;
		Connection conn=null;
		do{
			try {
				conn=DriverManager.getConnection();
				if(conn!=null){
					break;
				}
				Thread.sleep(500);
				i++;
			} catch (SQLException e) {
				e.printStackTrace();
			}catch(InterruptedException e){
				e.printStackTrace();
			}
		}while(conn==null&&i<5);
		return conn;
	}
	
	public static void closeConnection(Connection conn){
		try {
			conn.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	
	public static void closeResultSet(ResultSet rs){
		try {
			rs.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	
	public static void closePrepareStatement(PreparedStatement statement){
		try {
			statement.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	
	
	public static List<String> getTableColumns(Connection conn,String tableName){
		ResultSet resultSet=null;
		try {
			resultSet=conn.getMetaData().getColumns(null,"%", tableName,"%");
			List<String> columnNames=new ArrayList<String>();
			while(resultSet.next()){
				String columnName=resultSet.getString("COLUMN_NAME");
				columnNames.add(columnName);
			}
			return columnNames;
		}catch (SQLException e) {
			e.printStackTrace();
		}finally{
			closeResultSet(resultSet);
		}
		return null;
	}
	
	public static  List<BaseEntity> convertResultSetToEntity(ResultSet rs,List<String> columnNames,String tableName){
		Class cla=EntityUtils.getEntityByOracleTableName(tableName);
		Field[] fields=cla.getDeclaredFields();
		List<BaseEntity> result=new ArrayList<BaseEntity>();
		Map<String,Field> fieldMap=new HashMap<String,Field>();
		
		for(Field field:fields){
			Column column=field.getAnnotation(Column.class);
			String oracleColumn=column.oracle_column();
			if(oracleColumn.equals("")){
				oracleColumn=field.getName();
			}
			fieldMap.put(oracleColumn, field);
		}
		
		try {
			while(rs.next()){
				BaseEntity obj=(BaseEntity)cla.newInstance();
				Iterator<String> it=fieldMap.keySet().iterator();
				while(it.hasNext()){
					String fieldName=it.next();
					Field field=fieldMap.get(fieldName);
					field.setAccessible(true);
					String type=field.getType().toString();
					type=type.substring(type.lastIndexOf(".")+1);
					if(!type.equals("Date")){
						if(rs.getObject(fieldName) instanceof java.math.BigDecimal){
							if(type.equals("int")){
								field.set(obj, ((BigDecimal)rs.getObject(fieldName)).intValue());
							}else if(type.equals("long")){
								field.set(obj, ((BigDecimal)rs.getObject(fieldName)).longValue());
							}else if(type.equals("float")){
								field.set(obj, ((BigDecimal)rs.getObject(fieldName)).floatValue());
							}else  if(type.equals("double")){
								field.set(obj, ((BigDecimal)rs.getObject(fieldName)).doubleValue());
							}
						}else{
							field.set(obj, rs.getObject(fieldName));
						}
					}else{
						String fName=field.getName();
						fName=fName.substring(0,1).toUpperCase()+fName.substring(1);
						fName="set"+fName;
						Method m = cla.getDeclaredMethod(fName, Date.class);
						m.setAccessible(true);//因为写成private 所以这里必须设置
						if(rs.getObject(fieldName) instanceof oracle.sql.TIMESTAMP){
							m.invoke(obj,new Date(((TIMESTAMP)rs.getObject(fieldName)).timestampValue().getTime()));
						}else{
							m.invoke(obj, rs.getObject(fieldName));
						}
						
					}
				}
				result.add(obj);
			}
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch(SQLException e){
			e.printStackTrace();
		} catch (NoSuchMethodException e) {
			e.printStackTrace();
		} catch (SecurityException e) {
			e.printStackTrace();
		} catch (IllegalArgumentException e) {
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			e.printStackTrace();
		}
		return result;
	}
	
	public static long getRecordCount(String table){
		ConnectionPool pool=ConnectionPool.getInstance();
		ConnectionEntity entity=null;
		boolean exception=false;
		int count=0;
		do{
			try {
				entity = pool.getConnection();
				Connection conn=entity.getConnection();
				Statement statement=conn.createStatement();
				ResultSet rs=statement.executeQuery("select count(*) from "+table);
				if(rs.next()){
					return rs.getLong(1);
				}
			} catch (InterruptedException e) {
				exception=true;
				e.printStackTrace();
			} catch (SQLException e) {
				exception=true;
				e.printStackTrace();
			}finally{
				try {
					pool.releaseConnection(entity.getId());
				} catch (SQLException e) {
					e.printStackTrace();
				}
			}
			try {
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			count++;
			if(count>0)break;
		}while(exception=true);
		return 0L;
		
	}
}


main程序:

 

 

public class MainEnterance {
	private static ExecutorService executeService=Executors.newCachedThreadPool();
	public static void main(String[] args) throws Exception {
//		Enterance abc=new AbcEnterance(executeService);
//		abc.doWork();
		long startDate=new Date().getTime();
		Enterance creditReport=new CreditReportEnterance(executeService);
		creditReport.doWork();
		
//		Enterance creditReport=new CreditReportEnteranceUseCountDownLatch(executeService,1000,20,10000);
//		creditReport.doWork();
		
		///executeService.shutdown();
		
		long endDate=new Date().getTime();
		
		System.out.println("一共耗时:"+(endDate-startDate)/1000+"s");
	}

}

 

 

 

后续改进:

 

 

 

1数据库字段类型没有全覆盖

2支持其他关系型数据库

3从hbase导数据到关系型数据库

4错误恢复代码还没加上

5hbase rowkey设置策略

 

 

 

 

 

查询MYSQL和查询HBASE速度比较 MySQL,关系型数据库; HBase,NoSql数据库。 查询Mysql和查询HBase,到底哪个速度快呢? 与一些真正的大牛讨论时,他们说HBase写入速度,可以达到每秒1W。而HBase的理想速度为每秒10W。 来个实验说明一下,此实验只能表明,当前环境下运行状态。我的实验效果,没有到1W,还在优化中…   环境: 有3台虚拟机,运行Hadoop集群 阅读详情

相关推荐

程序员核心竞争力:数据与逻辑解耦的工程直觉

在现代分布式系统中,'数据库+编程语言'的单一技术栈已难以应对实时风控、高并发秒杀、跨源数据分析等复杂场景。理解数据生命周期(产生→传输→存储→计算→消费)和计算范式本质(命令式/函数式/响应式),是构建可扩展架构的基础。掌握ClickHouse列存聚合、Redis内存索引、Flink流处理等引擎的适用边界,结合Rust所有权、Go Goroutine调度、SQL与NoSQL语义差异等底层原理,才能实现从‘建表思维’到‘数据契约思维’、从‘语法熟练’到‘范式驾驭’的跃迁。本文聚焦真实项目中的技术选型逻辑与认

diedangxiang4092的博客 547

oracle expdp自动导出数据,Oracle expdp数据泵远程导出

expdp数据泵优点:支持并发多线程方式,可以远程导出,性能显著提高,可开并行parallel=n,比exp/imp实用工具相比,导出提高了10倍左右,导入提高了5倍左右。能根据备份时收集的元数据,自动创建用户、表对象,支持作业、表空间备份方式。缺点:需要在服务器上面执行创建目录授权,expdp、exp都支持远程本地导出。(exp不支持字段类型,BINARY_DOUBLE双精度二进制浮点类型num...

weixin_42576410的博客 595

金融级Java审计体系构建:从监控到合规的十大致命点与实战方案

在分布式系统和微服务架构中,日志记录与监控是保障系统可观测性的基础技术,用于追踪应用状态和排查问题。其核心原理是通过收集、聚合和分析应用运行时产生的日志、指标和链路数据,实现故障发现与性能优化。在金融、电商等高合规性行业,仅满足运维监控远远不够,监管要求所有关键操作必须可追溯、不可篡改,形成完整的证据链。这催生了审计日志这一细分领域,它强调操作的完整性、关联性和法律效力。本文聚焦Java技术栈,针对金融场景,深入剖析将普通监控体系升级为金融级审计体系必须跨越的十大认知鸿沟与实践陷阱,涵盖审计日志与业务日志的

weixin_34184561的博客 443

关系型数据库与NOSQL

关系型数据库把所有的数据都通过行和列的二元表现形式表示出来。 关系型数据库的优势: 1. 保持数据的一致性(事务处理) 2.由于以标准化为前提,数据更新的开销很小(相同的字段基本上都只有一处) 3. 可以进行Join等复杂查询 其中能够保持数据的一致性是关系型数据库的最大优势。 关系型数据库的不足: 不擅长的处理 1. 大量数据的写入处理 2. 为有数据更新的表做索引...

weixin_30823833的博客 2730

Java必知必会系列:数据库编程与JDBC

作者:禅与计算机程序设计艺术 1.背景介绍 JDBC简介 Java Database Connectivity(JDBC)是一个纯JAVAEE(Java Platform,Enterprise Edition)规范定义的API,用来访问关系型数据库管理系统(

AI天才研究院 152

【信息科学与工程学】计算机科学与自动化——第八十一篇 Java分布式软件高并发/高可用算法01

4. 消息队列(如Kafka的Topic分区,本质是范围)。3. 若是ACCEPT事件,bossGroup线程接受连接,创建SocketChannel,并将其注册到workerGroup的一个EventLoop的Selector上,关注READ事件。1. 分布式缓存分片(如Redis Cluster)。4. 分布式文件存储(如Ceph CRUSH)。6. 调用栈的模拟(如协程)。3. 服务网格(如Istio)的基础。2. 本地缓存与集中式缓存(如Redis)的一致性维护。3. 静态数据(如配置)缓存。

weixin_49199313的博客 1241

Hbase与Oracle比较(列式数据库与行式数据库)

Hbase与Oracle比较(列式数据库与行式数据库) 1 主要区别 Hbase适合大量插入同时又有读的情况 Hbase的瓶颈是硬盘传输速度,Oracle的瓶颈是硬盘寻道时间。     Hbase本质上只有一种操作,就是插入,其更新操作是插入一个带有新的时间戳的行,而删除是插入一个带有插入标记的行。     其主要操作是收集内存中一批数据,然后批量的写入硬盘,所以其写...

weixin_30361641的博客 453

Cadence Sigrity PowerDC实战:如何用PCB电热混合仿真解决散热难题(附详细配置步骤)

本文详细介绍了如何利用Cadence Sigrity PowerDC进行PCB电热混合仿真,以解决高功率密度设计中的散热难题。文章通过解析电热耦合原理,并附上详细的配置步骤与实战技巧,指导硬件工程师同步优化电气性能与热管理,从而在设计源头提升产品可靠性与效率。

weixin_29292535的博客 199

Java全栈体系路线

文章目录1)Java路线图2) 大数据学习路线3)前端学习路线4)Python学习路线 1)Java路线图 2) 大数据学习路线 3)前端学习路线 4)Python学习路线 ...

qq_43573663的博客 1万+

SIPVicious实战指南:从零开始掌握VoIP渗透测试(Kali Linux环境)

本文为SIPVicious实战指南,详细介绍了在Kali Linux环境下进行VoIP渗透测试的完整流程。从环境准备与工具安装开始,逐步讲解如何使用svmap扫描SIP服务器、svwar枚举PBX分机号,以及svcrack进行密码安全测试,并整合svreport生成报告。旨在帮助安全从业者从零开始,系统掌握这套经典开源工具,在授权范围内有效评估VoIP系统的安全性。

weixin_29327977的博客 541

Ubuntu安装opencv4.5(自己安装过程详细)

1.下载opencv 在opencv官网下载source版,下载链接 http://opencv.org/releases.html。别下载错版本 下载过程就不多说了。 2.安装过程 2.1解压 unzip opencv-4.5.0.zip cd opencv-4.5.0 2.2安装依赖的库 sudo apt-get install cmake sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-

weixin_45629790的博客 1万+

大数据工程师简历_大数据工程师简历范本02

个人技能1深刻理解hdfs分布式文件系统存储结构和高可用原理2熟练掌握hadoopmapreduce计算框架编程,对yarn的资源调度,作业监控有一定认识3掌握stormstreaming编程,对定时批量任务处理,分布式rpc有一定认识4深刻了解Spark底层运行机制,4熟练掌握scala编程,能运用scala进行sparkRDD,sparkstreaming编程5熟悉flume,kafk...

weixin_28789303的博客 2673

ROS从入门到精通0-1:教程导读

ROS概念太多太复杂?ROS从入门到精通系列订阅必看

FRIGIDWINTER的博客 1万+

java开发三两只

IDEA中设置注释模板 xxx不是抽象的, 并且未覆盖xxx中的抽象方法 @Valid 和 @Validated 注解用法详解 使用 @Valid 进行验证的时候,我们需要用一个对象去接收校验结果,最后根据校验结果判断,从而提示用户;@Validated 进行校验的时候,当校验不通过的时候,程序会抛出400异常,阻止方法中的代码执行,这时需要再写一个全局校验异常捕获处理类,然后返回校验提示。 @RequestParam和前端传入的参数名对应 @PathVariablespring3.0的一个新功

wudidabiaobei的博客 271

《UDS协议从入门到精通》系列——图解0x27:安全访问

什么是安全访问服务?应用场景和基本原理是什么?全网最直观详细的图解UDS-0x27:安全访问服务!!

车载系统攻城狮 7239

Android软键盘系统深度解析:架构、原理与实现

Android软键盘系统深度解析:架构与实现原理 本文系统剖析了Android软键盘的核心工作机制。作为系统级输入服务,软键盘具有双重属性:既是可安装的独立应用,又深度集成于系统框架中。文章详细解读了软键盘的系统架构,包括其与InputMethodManagerService(IMMS)和WindowManagerService(WMS)的交互机制,以及通过InputConnection实现的跨进程通信流程。同时分析了输入法窗口的特殊管理策略、布局调整模式,并深入探讨了输入预测引擎的实现原理,包括词典加载、

保持专注,保持热爱 117

2021,要这样学大数据开发

数据是一个企业得核心,这个是大家一个公认的观点,这是一个数据为王的时代,谁掌握了数据,谁就掌握了未来, 大数据开发的学习路线, (一)大数据不是编程语言,不是框架,也不是技术 顾名思义大数据,就是强调的数据本身,以及针对数据所作的采集、存储、分析、赋能所运用到的技术,所有学习大数据,它不是一门语言,它不是一个框架,它也不是一项技术。大数据是一个生态。 是一个行业和技术生态。 它是一系列编程语言,一系列框架和一系列技术的组合和运用。尤其是技术框架是非常的多,大数据领域主流的框架就达几十个之多 明确大数据方

jacky_zhuyuanlu的博客 958

RK3576 PCIE接口调试:基于RTL8111HS的网卡驱动移植

检查项方法电源电压复位时序检查设备树 reset-gpios链路速率设备识别lspci -vvv驱动加载。

小灰灰的博客 739

oracle拆分分区语法详解大全_2020级各专业方向课程详解

专业方向课程详解别人都在做的事,不代表你也非要做。别人追求的虚妄,也不一定就是你的极乐。不必迷茫,你想知道的,在这里都有……01大数据技术应用(特色)Java高级程序设计进阶面向对象常用类异常处理集合框架IO流多线程与反射Java网络编程类Java数据库编程数据库开发技术oracle数据库安装及配置oracle数据库的管理数据定义语言(DDL)数据操纵语言(DML)数据库中的约束聚合函数...

weixin_32737183的博客 166

【Java基础知识 1】Java入门级概述

优快云最强Java专栏,包含全部Java基础知识点、Java8新特性、Java集合、Java多线程、Java代码实例,理论结合实战,实现Java的轻松学习。

学Java,找哪吒 16万+

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

大数据工程师简历_大数据工程师简历3份

个人技能1深刻理解hdfs分布式文件系统存储结构和高可用原理2熟练掌握hadoopmapreduce计算框架编程,对yarn的资源调度,作业监控有一定认识3掌握stormstreaming编程,对定时批量任务处理,分布式rpc有一定认识4深刻了解Spark底层运行机制,4熟练掌握scala编程,能运用scala进行sparkRDD,sparkstreaming编程5熟悉flume,kafk...

weixin_39634898的博客 1866

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

JAVA学习流程

作为一名软件测试工程师应届生,在秋招中屡屡受挫,在大二时因为代码编程能力不强,故转到软件测试这个行业。当初的目光短浅,在今日得到了沉重的代价。在多此次面试中,面试官给得建议就是"你还是好好学习一门编程语言吧,为了以后的工作可以游刃有余",这句话深深的刺激到我。因此多次思考后,开始自学JAVA编程,望坚持不懈,再接再厉,在开发世界取得好的成就; JAVA的学习流程 通过网上了解分为五个阶段; ...

qq_39074545的博客 342

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

Java工程师面试题积累(2.0版)

1. 如何判断一个数是2的幂。个人认为,数字转化为二进制,符号位为0,余下部分有且只有最左边一位是1,其余位都是0,才是2的幂。 原理是 乘二则向左进一位。2. 陷阱面试题:在Java中

铁锚的优快云博客 3849

七面阿里:现在分享一下阿里最全面试116题:阿里天猫、蚂蚁金服、阿里巴巴面试题含答案...

貌似这一点适应的行业最广,但是我可以很肯定的说:当你从事Java一年后,重新找工作时,才会真实的感受到这句话。 工作第一年,往往是什么都充满新鲜感,什么都学习,冲劲十足的一年;WEB行业知识更新特别快,今天一个框架的新版本,明天又是另一个新框架,有时往往根据项目的需要来不断学习新东西;所有,很多时候感觉,自己用过的东西真多呀!但是真正深入...

weixin_33713707的博客 291

LarkMidTable 数据中台详解:larkmidtable-web 产品功能、部署配置与任务执行链路

本文基于 `larkmidtable-web/README.md` 及其关联的安装文档展开,系统讲解 LarkMidTable 数据中台的产品定位、功能矩阵与技术选型,并结合开源仓库中的 Maven 多模块工程、`application.yml` 配置、建库 SQL 与 flinkx/datax 启动脚本,完整还原从拉取代码、初始化数据库到启动 `larkmidtable-web` 后端服务并接入

gitblog_00849的博客 139

2023开源数据目录选型指南:DataHub、Atlas、Marquez等五款实战对比

数据目录(Data Catalog)是现代数据平台的核心元数据治理基础设施,其本质是通过自动采集、血缘追踪、语义标注与协作搜索,解决‘数据找不到、看不懂、信不过’的典型问题。随着2023年技术演进,主流开源方案已从静态元数据快照升级为支持字段级血缘、结构化业务上下文和消费端反向驱动的动态协作中枢。在金融、电商、SaaS等强合规、多源异构场景中,Open-Source Data Catalog 的可控性、可定制性与国产化适配能力,正成为替代闭源方案的关键技术价值。本文聚焦真实生产环境验证的五款工具——Apac

weixin_34189116的博客 411
上一篇: hbase所谓的三维有序存储
下一篇: HBase 常用Shell命令
hxpjava1
博客等级 码龄19年 1365粉丝 511原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

hxpjava1

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值