首页 文章 精选 留言 我的

精选列表

搜索[webpack入门],共10000篇文章
优秀的个人博客,低调大师

Hadoop MapReduce编程 API入门系列之网页排序(二十八)

Map output bytes=247 Map output materialized bytes=275 Input split bytes=139 Combine input records=0 Combine output records=0 Reduce input groups=4 Reduce shuffle bytes=275 Reduce input records=11 Reduce output records=4 Spilled Records=22 Shuffled Maps =1 Failed Shuffles=0 Merged Map outputs=1 GC time elapsed (ms)=0 CPU time spent (ms)=0 Physical memory (bytes) snapshot=0 Virtual memory (bytes) snapshot=0 Total committed heap usage (bytes)=1439694848 Shuffle Errors BAD_ID=0 CONNECTION=0 IO_ERROR=0 WRONG_LENGTH=0 WRONG_MAP=0 WRONG_REDUCE=0 File Input Format Counters Bytes Read=119 File Output Format Counters Bytes Written=113 zhouls.bigdata.myMapReduce.pagerank.RunJob$Mycounter my=17 success. 17 2016-12-13 19:07:44,783 INFO [org.apache.hadoop.metrics.jvm.JvmMetrics] - Cannot initialize JVM Metrics with processName=JobTracker, sessionId= - already initialized 2016-12-13 19:07:44,796 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this. 2016-12-13 19:07:44,799 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - No job jar file set. User classes may not be found. See Job or Job#setJar(String). 2016-12-13 19:07:45,231 INFO [org.apache.hadoop.mapreduce.lib.input.FileInputFormat] - Total input paths to process : 1 2016-12-13 19:07:45,245 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - number of splits:1 2016-12-13 19:07:45,266 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - Submitting tokens for job: job_local455505407_0021 2016-12-13 19:07:45,483 INFO [org.apache.hadoop.mapreduce.Job] - The url to track the job: http://localhost:8080/ 2016-12-13 19:07:45,484 INFO [org.apache.hadoop.mapreduce.Job] - Running job: job_local455505407_0021 2016-12-13 19:07:45,484 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter set in config null 2016-12-13 19:07:45,485 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter 2016-12-13 19:07:45,495 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for map tasks 2016-12-13 19:07:45,495 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local455505407_0021_m_000000_0 2016-12-13 19:07:45,500 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:45,559 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@223b788b 2016-12-13 19:07:45,565 INFO [org.apache.hadoop.mapred.MapTask] - Processing split: file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr20/part-r-00000:0+101 2016-12-13 19:07:45,597 INFO [org.apache.hadoop.mapred.MapTask] - (EQUATOR) 0 kvi 26214396(104857584) 2016-12-13 19:07:45,597 INFO [org.apache.hadoop.mapred.MapTask] - mapreduce.task.io.sort.mb: 100 2016-12-13 19:07:45,597 INFO [org.apache.hadoop.mapred.MapTask] - soft limit at 83886080 2016-12-13 19:07:45,597 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufvoid = 104857600 2016-12-13 19:07:45,598 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396; length = 6553600 2016-12-13 19:07:45,600 INFO [org.apache.hadoop.mapred.MapTask] - Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer 2016-12-13 19:07:45,608 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 2016-12-13 19:07:45,609 INFO [org.apache.hadoop.mapred.MapTask] - Starting flush of map output 2016-12-13 19:07:45,609 INFO [org.apache.hadoop.mapred.MapTask] - Spilling map output 2016-12-13 19:07:45,609 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufend = 255; bufvoid = 104857600 2016-12-13 19:07:45,610 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396(104857584); kvend = 26214356(104857424); length = 41/6553600 2016-12-13 19:07:45,625 INFO [org.apache.hadoop.mapred.MapTask] - Finished spill 0 2016-12-13 19:07:45,631 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local455505407_0021_m_000000_0 is done. And is in the process of committing 2016-12-13 19:07:45,638 INFO [org.apache.hadoop.mapred.LocalJobRunner] - file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr20/part-r-00000:0+101 2016-12-13 19:07:45,639 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local455505407_0021_m_000000_0' done. 2016-12-13 19:07:45,639 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local455505407_0021_m_000000_0 2016-12-13 19:07:45,639 INFO [org.apache.hadoop.mapred.LocalJobRunner] - map task executor complete. 2016-12-13 19:07:45,640 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for reduce tasks 2016-12-13 19:07:45,641 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local455505407_0021_r_000000_0 2016-12-13 19:07:45,645 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:45,690 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@7d5e1574 2016-12-13 19:07:45,691 INFO [org.apache.hadoop.mapred.ReduceTask] - Using ShuffleConsumerPlugin: org.apache.hadoop.mapreduce.task.reduce.Shuffle@2bd2b2f9 2016-12-13 19:07:45,703 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - MergerManager: memoryLimit=1327077760, maxSingleShuffleLimit=331769440, mergeThreshold=875871360, ioSortFactor=10, memToMemMergeOutputsThreshold=10 2016-12-13 19:07:45,704 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - attempt_local455505407_0021_r_000000_0 Thread started: EventFetcher for fetching Map Completion Events 2016-12-13 19:07:45,709 INFO [org.apache.hadoop.mapreduce.task.reduce.LocalFetcher] - localfetcher#21 about to shuffle output of map attempt_local455505407_0021_m_000000_0 decomp: 279 len: 283 to MEMORY 2016-12-13 19:07:45,710 INFO [org.apache.hadoop.mapreduce.task.reduce.InMemoryMapOutput] - Read 279 bytes from map-output for attempt_local455505407_0021_m_000000_0 2016-12-13 19:07:45,711 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - closeInMemoryFile -> map-output of size: 279, inMemoryMapOutputs.size() -> 1, commitMemory -> 0, usedMemory ->279 2016-12-13 19:07:45,712 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - EventFetcher is interrupted.. Returning 2016-12-13 19:07:45,714 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:45,715 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - finalMerge called with 1 in-memory map-outputs and 0 on-disk map-outputs 2016-12-13 19:07:45,729 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:45,730 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 275 bytes 2016-12-13 19:07:45,732 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merged 1 segments, 279 bytes to disk to satisfy reduce memory limit 2016-12-13 19:07:45,734 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 1 files, 283 bytes from disk 2016-12-13 19:07:45,734 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 0 segments, 0 bytes from memory into reduce 2016-12-13 19:07:45,734 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:45,736 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 275 bytes 2016-12-13 19:07:45,737 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. *********** new pageRank value is 0.21104025855884012 3___________ *********** new pageRank value is 0.3575070100293671 5___________ *********** new pageRank value is 0.4016854782039228 6___________ *********** new pageRank value is 0.1286040574733812 1___________ 2016-12-13 19:07:45,749 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local455505407_0021_r_000000_0 is done. And is in the process of committing 2016-12-13 19:07:45,753 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:45,753 INFO [org.apache.hadoop.mapred.Task] - Task attempt_local455505407_0021_r_000000_0 is allowed to commit now 2016-12-13 19:07:45,762 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - Saved output of task 'attempt_local455505407_0021_r_000000_0' to file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr21/_temporary/0/task_local455505407_0021_r_000000 2016-12-13 19:07:45,764 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce 2016-12-13 19:07:45,764 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local455505407_0021_r_000000_0' done. 2016-12-13 19:07:45,764 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local455505407_0021_r_000000_0 2016-12-13 19:07:45,765 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce task executor complete. 2016-12-13 19:07:46,485 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local455505407_0021 running in uber mode : false 2016-12-13 19:07:46,486 INFO [org.apache.hadoop.mapreduce.Job] - map 100% reduce 100% 2016-12-13 19:07:46,487 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local455505407_0021 completed successfully 2016-12-13 19:07:46,498 INFO [org.apache.hadoop.mapreduce.Job] - Counters: 34 File System Counters FILE: Number of bytes read=35976 FILE: Number of bytes written=8181702 FILE: Number of read operations=0 FILE: Number of large read operations=0 FILE: Number of write operations=0 Map-Reduce Framework Map input records=4 Map output records=11 Map output bytes=255 Map output materialized bytes=283 Input split bytes=139 Combine input records=0 Combine output records=0 Reduce input groups=4 Reduce shuffle bytes=283 Reduce input records=11 Reduce output records=4 Spilled Records=22 Shuffled Maps =1 Failed Shuffles=0 Merged Map outputs=1 GC time elapsed (ms)=0 CPU time spent (ms)=0 Physical memory (bytes) snapshot=0 Virtual memory (bytes) snapshot=0 Total committed heap usage (bytes)=1588592640 Shuffle Errors BAD_ID=0 CONNECTION=0 IO_ERROR=0 WRONG_LENGTH=0 WRONG_MAP=0 WRONG_REDUCE=0 File Input Format Counters Bytes Read=121 File Output Format Counters Bytes Written=111 zhouls.bigdata.myMapReduce.pagerank.RunJob$Mycounter my=15 success. 15 2016-12-13 19:07:46,508 INFO [org.apache.hadoop.metrics.jvm.JvmMetrics] - Cannot initialize JVM Metrics with processName=JobTracker, sessionId= - already initialized 2016-12-13 19:07:46,516 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this. 2016-12-13 19:07:46,519 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - No job jar file set. User classes may not be found. See Job or Job#setJar(String). 2016-12-13 19:07:46,868 INFO [org.apache.hadoop.mapreduce.lib.input.FileInputFormat] - Total input paths to process : 1 2016-12-13 19:07:46,879 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - number of splits:1 2016-12-13 19:07:46,896 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - Submitting tokens for job: job_local1152686492_0022 2016-12-13 19:07:47,037 INFO [org.apache.hadoop.mapreduce.Job] - The url to track the job: http://localhost:8080/ 2016-12-13 19:07:47,037 INFO [org.apache.hadoop.mapreduce.Job] - Running job: job_local1152686492_0022 2016-12-13 19:07:47,037 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter set in config null 2016-12-13 19:07:47,039 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter 2016-12-13 19:07:47,045 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for map tasks 2016-12-13 19:07:47,045 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local1152686492_0022_m_000000_0 2016-12-13 19:07:47,048 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:47,105 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@35f8fa7b 2016-12-13 19:07:47,109 INFO [org.apache.hadoop.mapred.MapTask] - Processing split: file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr21/part-r-00000:0+99 2016-12-13 19:07:47,131 INFO [org.apache.hadoop.mapred.MapTask] - (EQUATOR) 0 kvi 26214396(104857584) 2016-12-13 19:07:47,132 INFO [org.apache.hadoop.mapred.MapTask] - mapreduce.task.io.sort.mb: 100 2016-12-13 19:07:47,132 INFO [org.apache.hadoop.mapred.MapTask] - soft limit at 83886080 2016-12-13 19:07:47,132 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufvoid = 104857600 2016-12-13 19:07:47,132 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396; length = 6553600 2016-12-13 19:07:47,133 INFO [org.apache.hadoop.mapred.MapTask] - Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer 2016-12-13 19:07:47,139 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 2016-12-13 19:07:47,140 INFO [org.apache.hadoop.mapred.MapTask] - Starting flush of map output 2016-12-13 19:07:47,140 INFO [org.apache.hadoop.mapred.MapTask] - Spilling map output 2016-12-13 19:07:47,140 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufend = 248; bufvoid = 104857600 2016-12-13 19:07:47,140 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396(104857584); kvend = 26214356(104857424); length = 41/6553600 2016-12-13 19:07:47,155 INFO [org.apache.hadoop.mapred.MapTask] - Finished spill 0 2016-12-13 19:07:47,160 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local1152686492_0022_m_000000_0 is done. And is in the process of committing 2016-12-13 19:07:47,165 INFO [org.apache.hadoop.mapred.LocalJobRunner] - file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr21/part-r-00000:0+99 2016-12-13 19:07:47,165 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local1152686492_0022_m_000000_0' done. 2016-12-13 19:07:47,165 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local1152686492_0022_m_000000_0 2016-12-13 19:07:47,165 INFO [org.apache.hadoop.mapred.LocalJobRunner] - map task executor complete. 2016-12-13 19:07:47,166 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for reduce tasks 2016-12-13 19:07:47,167 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local1152686492_0022_r_000000_0 2016-12-13 19:07:47,169 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:47,215 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@6df4957a 2016-12-13 19:07:47,215 INFO [org.apache.hadoop.mapred.ReduceTask] - Using ShuffleConsumerPlugin: org.apache.hadoop.mapreduce.task.reduce.Shuffle@5481b4fb 2016-12-13 19:07:47,217 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - MergerManager: memoryLimit=1327077760, maxSingleShuffleLimit=331769440, mergeThreshold=875871360, ioSortFactor=10, memToMemMergeOutputsThreshold=10 2016-12-13 19:07:47,219 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - attempt_local1152686492_0022_r_000000_0 Thread started: EventFetcher for fetching Map Completion Events 2016-12-13 19:07:47,224 INFO [org.apache.hadoop.mapreduce.task.reduce.LocalFetcher] - localfetcher#22 about to shuffle output of map attempt_local1152686492_0022_m_000000_0 decomp: 272 len: 276 to MEMORY 2016-12-13 19:07:47,225 INFO [org.apache.hadoop.mapreduce.task.reduce.InMemoryMapOutput] - Read 272 bytes from map-output for attempt_local1152686492_0022_m_000000_0 2016-12-13 19:07:47,225 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - closeInMemoryFile -> map-output of size: 272, inMemoryMapOutputs.size() -> 1, commitMemory -> 0, usedMemory ->272 2016-12-13 19:07:47,227 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - EventFetcher is interrupted.. Returning 2016-12-13 19:07:47,228 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:47,228 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - finalMerge called with 1 in-memory map-outputs and 0 on-disk map-outputs 2016-12-13 19:07:47,237 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:47,238 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 268 bytes 2016-12-13 19:07:47,240 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merged 1 segments, 272 bytes to disk to satisfy reduce memory limit 2016-12-13 19:07:47,241 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 1 files, 276 bytes from disk 2016-12-13 19:07:47,241 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 0 segments, 0 bytes from memory into reduce 2016-12-13 19:07:47,242 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:47,243 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 268 bytes 2016-12-13 19:07:47,244 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. *********** new pageRank value is 0.2082163282366672 2___________ *********** new pageRank value is 0.3525651625503612 4___________ *********** new pageRank value is 0.396037682951149 5___________ *********** new pageRank value is 0.12719210988750704 1___________ 2016-12-13 19:07:47,256 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local1152686492_0022_r_000000_0 is done. And is in the process of committing 2016-12-13 19:07:47,260 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:47,261 INFO [org.apache.hadoop.mapred.Task] - Task attempt_local1152686492_0022_r_000000_0 is allowed to commit now 2016-12-13 19:07:47,270 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - Saved output of task 'attempt_local1152686492_0022_r_000000_0' to file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr22/_temporary/0/task_local1152686492_0022_r_000000 2016-12-13 19:07:47,273 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce 2016-12-13 19:07:47,273 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local1152686492_0022_r_000000_0' done. 2016-12-13 19:07:47,273 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local1152686492_0022_r_000000_0 2016-12-13 19:07:47,273 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce task executor complete. 2016-12-13 19:07:48,038 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local1152686492_0022 running in uber mode : false 2016-12-13 19:07:48,039 INFO [org.apache.hadoop.mapreduce.Job] - map 100% reduce 100% 2016-12-13 19:07:48,040 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local1152686492_0022 completed successfully 2016-12-13 19:07:48,048 INFO [org.apache.hadoop.mapreduce.Job] - Counters: 34 File System Counters FILE: Number of bytes read=37782 FILE: Number of bytes written=8572508 FILE: Number of read operations=0 FILE: Number of large read operations=0 FILE: Number of write operations=0 Map-Reduce Framework Map input records=4 Map output records=11 Map output bytes=248 Map output materialized bytes=276 Input split bytes=139 Combine input records=0 Combine output records=0 Reduce input groups=4 Reduce shuffle bytes=276 Reduce input records=11 Reduce output records=4 Spilled Records=22 Shuffled Maps =1 Failed Shuffles=0 Merged Map outputs=1 GC time elapsed (ms)=13 CPU time spent (ms)=0 Physical memory (bytes) snapshot=0 Virtual memory (bytes) snapshot=0 Total committed heap usage (bytes)=1588592640 Shuffle Errors BAD_ID=0 CONNECTION=0 IO_ERROR=0 WRONG_LENGTH=0 WRONG_MAP=0 WRONG_REDUCE=0 File Input Format Counters Bytes Read=119 File Output Format Counters Bytes Written=110 zhouls.bigdata.myMapReduce.pagerank.RunJob$Mycounter my=12 success. 12 2016-12-13 19:07:48,059 INFO [org.apache.hadoop.metrics.jvm.JvmMetrics] - Cannot initialize JVM Metrics with processName=JobTracker, sessionId= - already initialized 2016-12-13 19:07:48,070 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this. 2016-12-13 19:07:48,073 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - No job jar file set. User classes may not be found. See Job or Job#setJar(String). 2016-12-13 19:07:48,425 INFO [org.apache.hadoop.mapreduce.lib.input.FileInputFormat] - Total input paths to process : 1 2016-12-13 19:07:48,446 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - number of splits:1 2016-12-13 19:07:48,465 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - Submitting tokens for job: job_local1854065889_0023 2016-12-13 19:07:48,612 INFO [org.apache.hadoop.mapreduce.Job] - The url to track the job: http://localhost:8080/ 2016-12-13 19:07:48,613 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter set in config null 2016-12-13 19:07:48,613 INFO [org.apache.hadoop.mapreduce.Job] - Running job: job_local1854065889_0023 2016-12-13 19:07:48,615 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter 2016-12-13 19:07:48,621 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for map tasks 2016-12-13 19:07:48,622 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local1854065889_0023_m_000000_0 2016-12-13 19:07:48,624 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:48,668 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@135c5527 2016-12-13 19:07:48,672 INFO [org.apache.hadoop.mapred.MapTask] - Processing split: file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr22/part-r-00000:0+98 2016-12-13 19:07:48,709 INFO [org.apache.hadoop.mapred.MapTask] - (EQUATOR) 0 kvi 26214396(104857584) 2016-12-13 19:07:48,710 INFO [org.apache.hadoop.mapred.MapTask] - mapreduce.task.io.sort.mb: 100 2016-12-13 19:07:48,710 INFO [org.apache.hadoop.mapred.MapTask] - soft limit at 83886080 2016-12-13 19:07:48,710 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufvoid = 104857600 2016-12-13 19:07:48,710 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396; length = 6553600 2016-12-13 19:07:48,711 INFO [org.apache.hadoop.mapred.MapTask] - Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer 2016-12-13 19:07:48,720 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 2016-12-13 19:07:48,722 INFO [org.apache.hadoop.mapred.MapTask] - Starting flush of map output 2016-12-13 19:07:48,722 INFO [org.apache.hadoop.mapred.MapTask] - Spilling map output 2016-12-13 19:07:48,722 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufend = 247; bufvoid = 104857600 2016-12-13 19:07:48,722 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396(104857584); kvend = 26214356(104857424); length = 41/6553600 2016-12-13 19:07:48,738 INFO [org.apache.hadoop.mapred.MapTask] - Finished spill 0 2016-12-13 19:07:48,742 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local1854065889_0023_m_000000_0 is done. And is in the process of committing 2016-12-13 19:07:48,746 INFO [org.apache.hadoop.mapred.LocalJobRunner] - file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr22/part-r-00000:0+98 2016-12-13 19:07:48,746 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local1854065889_0023_m_000000_0' done. 2016-12-13 19:07:48,746 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local1854065889_0023_m_000000_0 2016-12-13 19:07:48,746 INFO [org.apache.hadoop.mapred.LocalJobRunner] - map task executor complete. 2016-12-13 19:07:48,747 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for reduce tasks 2016-12-13 19:07:48,748 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local1854065889_0023_r_000000_0 2016-12-13 19:07:48,751 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:48,798 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@21287ab4 2016-12-13 19:07:48,798 INFO [org.apache.hadoop.mapred.ReduceTask] - Using ShuffleConsumerPlugin: org.apache.hadoop.mapreduce.task.reduce.Shuffle@688fd06d 2016-12-13 19:07:48,801 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - MergerManager: memoryLimit=1327077760, maxSingleShuffleLimit=331769440, mergeThreshold=875871360, ioSortFactor=10, memToMemMergeOutputsThreshold=10 2016-12-13 19:07:48,802 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - attempt_local1854065889_0023_r_000000_0 Thread started: EventFetcher for fetching Map Completion Events 2016-12-13 19:07:48,807 INFO [org.apache.hadoop.mapreduce.task.reduce.LocalFetcher] - localfetcher#23 about to shuffle output of map attempt_local1854065889_0023_m_000000_0 decomp: 271 len: 275 to MEMORY 2016-12-13 19:07:48,809 INFO [org.apache.hadoop.mapreduce.task.reduce.InMemoryMapOutput] - Read 271 bytes from map-output for attempt_local1854065889_0023_m_000000_0 2016-12-13 19:07:48,811 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - closeInMemoryFile -> map-output of size: 271, inMemoryMapOutputs.size() -> 1, commitMemory -> 0, usedMemory ->271 2016-12-13 19:07:48,815 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - EventFetcher is interrupted.. Returning 2016-12-13 19:07:48,817 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:48,818 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - finalMerge called with 1 in-memory map-outputs and 0 on-disk map-outputs 2016-12-13 19:07:48,831 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:48,832 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 267 bytes 2016-12-13 19:07:48,834 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merged 1 segments, 271 bytes to disk to satisfy reduce memory limit 2016-12-13 19:07:48,836 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 1 files, 275 bytes from disk 2016-12-13 19:07:48,836 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 0 segments, 0 bytes from memory into reduce 2016-12-13 19:07:48,836 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:48,837 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 267 bytes 2016-12-13 19:07:48,839 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. *********** new pageRank value is 0.20581601525423832 2___________ *********** new pageRank value is 0.3483646014570123 4___________ *********** new pageRank value is 0.3912370348699975 4___________ *********** new pageRank value is 0.12599193950058354 1___________ 2016-12-13 19:07:48,854 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local1854065889_0023_r_000000_0 is done. And is in the process of committing 2016-12-13 19:07:48,858 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:48,859 INFO [org.apache.hadoop.mapred.Task] - Task attempt_local1854065889_0023_r_000000_0 is allowed to commit now 2016-12-13 19:07:48,870 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - Saved output of task 'attempt_local1854065889_0023_r_000000_0' to file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr23/_temporary/0/task_local1854065889_0023_r_000000 2016-12-13 19:07:48,879 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce 2016-12-13 19:07:48,880 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local1854065889_0023_r_000000_0' done. 2016-12-13 19:07:48,882 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local1854065889_0023_r_000000_0 2016-12-13 19:07:48,883 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce task executor complete. 2016-12-13 19:07:49,614 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local1854065889_0023 running in uber mode : false 2016-12-13 19:07:49,615 INFO [org.apache.hadoop.mapreduce.Job] - map 100% reduce 100% 2016-12-13 19:07:49,617 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local1854065889_0023 completed successfully 2016-12-13 19:07:49,637 INFO [org.apache.hadoop.mapreduce.Job] - Counters: 34 File System Counters FILE: Number of bytes read=39570 FILE: Number of bytes written=8963305 FILE: Number of read operations=0 FILE: Number of large read operations=0 FILE: Number of write operations=0 Map-Reduce Framework Map input records=4 Map output records=11 Map output bytes=247 Map output materialized bytes=275 Input split bytes=139 Combine input records=0 Combine output records=0 Reduce input groups=4 Reduce shuffle bytes=275 Reduce input records=11 Reduce output records=4 Spilled Records=22 Shuffled Maps =1 Failed Shuffles=0 Merged Map outputs=1 GC time elapsed (ms)=13 CPU time spent (ms)=0 Physical memory (bytes) snapshot=0 Virtual memory (bytes) snapshot=0 Total committed heap usage (bytes)=1755316224 Shuffle Errors BAD_ID=0 CONNECTION=0 IO_ERROR=0 WRONG_LENGTH=0 WRONG_MAP=0 WRONG_REDUCE=0 File Input Format Counters Bytes Read=118 File Output Format Counters Bytes Written=112 zhouls.bigdata.myMapReduce.pagerank.RunJob$Mycounter my=11 success. 11 2016-12-13 19:07:49,648 INFO [org.apache.hadoop.metrics.jvm.JvmMetrics] - Cannot initialize JVM Metrics with processName=JobTracker, sessionId= - already initialized 2016-12-13 19:07:49,656 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this. 2016-12-13 19:07:49,659 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - No job jar file set. User classes may not be found. See Job or Job#setJar(String). 2016-12-13 19:07:50,057 INFO [org.apache.hadoop.mapreduce.lib.input.FileInputFormat] - Total input paths to process : 1 2016-12-13 19:07:50,073 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - number of splits:1 2016-12-13 19:07:50,093 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - Submitting tokens for job: job_local2101720639_0024 2016-12-13 19:07:50,248 INFO [org.apache.hadoop.mapreduce.Job] - The url to track the job: http://localhost:8080/ 2016-12-13 19:07:50,249 INFO [org.apache.hadoop.mapreduce.Job] - Running job: job_local2101720639_0024 2016-12-13 19:07:50,251 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter set in config null 2016-12-13 19:07:50,252 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter 2016-12-13 19:07:50,262 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for map tasks 2016-12-13 19:07:50,263 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local2101720639_0024_m_000000_0 2016-12-13 19:07:50,267 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:50,324 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@63a803dc 2016-12-13 19:07:50,329 INFO [org.apache.hadoop.mapred.MapTask] - Processing split: file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr23/part-r-00000:0+100 2016-12-13 19:07:50,405 INFO [org.apache.hadoop.mapred.MapTask] - (EQUATOR) 0 kvi 26214396(104857584) 2016-12-13 19:07:50,405 INFO [org.apache.hadoop.mapred.MapTask] - mapreduce.task.io.sort.mb: 100 2016-12-13 19:07:50,405 INFO [org.apache.hadoop.mapred.MapTask] - soft limit at 83886080 2016-12-13 19:07:50,405 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufvoid = 104857600 2016-12-13 19:07:50,406 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396; length = 6553600 2016-12-13 19:07:50,407 INFO [org.apache.hadoop.mapred.MapTask] - Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer 2016-12-13 19:07:50,417 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 2016-12-13 19:07:50,418 INFO [org.apache.hadoop.mapred.MapTask] - Starting flush of map output 2016-12-13 19:07:50,418 INFO [org.apache.hadoop.mapred.MapTask] - Spilling map output 2016-12-13 19:07:50,418 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufend = 253; bufvoid = 104857600 2016-12-13 19:07:50,418 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396(104857584); kvend = 26214356(104857424); length = 41/6553600 2016-12-13 19:07:50,437 INFO [org.apache.hadoop.mapred.MapTask] - Finished spill 0 2016-12-13 19:07:50,442 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local2101720639_0024_m_000000_0 is done. And is in the process of committing 2016-12-13 19:07:50,447 INFO [org.apache.hadoop.mapred.LocalJobRunner] - file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr23/part-r-00000:0+100 2016-12-13 19:07:50,448 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local2101720639_0024_m_000000_0' done. 2016-12-13 19:07:50,448 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local2101720639_0024_m_000000_0 2016-12-13 19:07:50,448 INFO [org.apache.hadoop.mapred.LocalJobRunner] - map task executor complete. 2016-12-13 19:07:50,450 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for reduce tasks 2016-12-13 19:07:50,450 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local2101720639_0024_r_000000_0 2016-12-13 19:07:50,454 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:50,523 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@7e37d95 2016-12-13 19:07:50,524 INFO [org.apache.hadoop.mapred.ReduceTask] - Using ShuffleConsumerPlugin: org.apache.hadoop.mapreduce.task.reduce.Shuffle@6849c53e 2016-12-13 19:07:50,526 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - MergerManager: memoryLimit=1327077760, maxSingleShuffleLimit=331769440, mergeThreshold=875871360, ioSortFactor=10, memToMemMergeOutputsThreshold=10 2016-12-13 19:07:50,535 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - attempt_local2101720639_0024_r_000000_0 Thread started: EventFetcher for fetching Map Completion Events 2016-12-13 19:07:50,539 INFO [org.apache.hadoop.mapreduce.task.reduce.LocalFetcher] - localfetcher#24 about to shuffle output of map attempt_local2101720639_0024_m_000000_0 decomp: 277 len: 281 to MEMORY 2016-12-13 19:07:50,541 INFO [org.apache.hadoop.mapreduce.task.reduce.InMemoryMapOutput] - Read 277 bytes from map-output for attempt_local2101720639_0024_m_000000_0 2016-12-13 19:07:50,541 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - closeInMemoryFile -> map-output of size: 277, inMemoryMapOutputs.size() -> 1, commitMemory -> 0, usedMemory ->277 2016-12-13 19:07:50,542 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - EventFetcher is interrupted.. Returning 2016-12-13 19:07:50,544 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:50,545 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - finalMerge called with 1 in-memory map-outputs and 0 on-disk map-outputs 2016-12-13 19:07:50,559 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:50,559 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 273 bytes 2016-12-13 19:07:50,562 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merged 1 segments, 277 bytes to disk to satisfy reduce memory limit 2016-12-13 19:07:50,563 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 1 files, 281 bytes from disk 2016-12-13 19:07:50,563 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 0 segments, 0 bytes from memory into reduce 2016-12-13 19:07:50,563 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:50,564 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 273 bytes 2016-12-13 19:07:50,566 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. *********** new pageRank value is 0.20377573981974895 2___________ *********** new pageRank value is 0.3447941205905482 3___________ *********** new pageRank value is 0.3871564855262084 4___________ *********** new pageRank value is 0.12497180648305128 1___________ 2016-12-13 19:07:50,580 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local2101720639_0024_r_000000_0 is done. And is in the process of committing 2016-12-13 19:07:50,584 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:50,585 INFO [org.apache.hadoop.mapred.Task] - Task attempt_local2101720639_0024_r_000000_0 is allowed to commit now 2016-12-13 19:07:50,595 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - Saved output of task 'attempt_local2101720639_0024_r_000000_0' to file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr24/_temporary/0/task_local2101720639_0024_r_000000 2016-12-13 19:07:50,597 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce 2016-12-13 19:07:50,597 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local2101720639_0024_r_000000_0' done. 2016-12-13 19:07:50,598 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local2101720639_0024_r_000000_0 2016-12-13 19:07:50,598 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce task executor complete. 2016-12-13 19:07:51,250 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local2101720639_0024 running in uber mode : false 2016-12-13 19:07:51,252 INFO [org.apache.hadoop.mapreduce.Job] - map 100% reduce 100% 2016-12-13 19:07:51,253 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local2101720639_0024 completed successfully 2016-12-13 19:07:51,263 INFO [org.apache.hadoop.mapreduce.Job] - Counters: 34 File System Counters FILE: Number of bytes read=41372 FILE: Number of bytes written=9354121 FILE: Number of read operations=0 FILE: Number of large read operations=0 FILE: Number of write operations=0 Map-Reduce Framework Map input records=4 Map output records=11 Map output bytes=253 Map output materialized bytes=281 Input split bytes=139 Combine input records=0 Combine output records=0 Reduce input groups=4 Reduce shuffle bytes=281 Reduce input records=11 Reduce output records=4 Spilled Records=22 Shuffled Maps =1 Failed Shuffles=0 Merged Map outputs=1 GC time elapsed (ms)=0 CPU time spent (ms)=0 Physical memory (bytes) snapshot=0 Virtual memory (bytes) snapshot=0 Total committed heap usage (bytes)=1755316224 Shuffle Errors BAD_ID=0 CONNECTION=0 IO_ERROR=0 WRONG_LENGTH=0 WRONG_MAP=0 WRONG_REDUCE=0 File Input Format Counters Bytes Read=120 File Output Format Counters Bytes Written=112 zhouls.bigdata.myMapReduce.pagerank.RunJob$Mycounter my=10 success. 10 2016-12-13 19:07:51,279 INFO [org.apache.hadoop.metrics.jvm.JvmMetrics] - Cannot initialize JVM Metrics with processName=JobTracker, sessionId= - already initialized 2016-12-13 19:07:51,292 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this. 2016-12-13 19:07:51,295 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - No job jar file set. User classes may not be found. See Job or Job#setJar(String). 2016-12-13 19:07:51,881 INFO [org.apache.hadoop.mapreduce.lib.input.FileInputFormat] - Total input paths to process : 1 2016-12-13 19:07:51,893 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - number of splits:1 2016-12-13 19:07:51,913 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - Submitting tokens for job: job_local756232932_0025 2016-12-13 19:07:52,079 INFO [org.apache.hadoop.mapreduce.Job] - The url to track the job: http://localhost:8080/ 2016-12-13 19:07:52,080 INFO [org.apache.hadoop.mapreduce.Job] - Running job: job_local756232932_0025 2016-12-13 19:07:52,080 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter set in config null 2016-12-13 19:07:52,081 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter 2016-12-13 19:07:52,087 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for map tasks 2016-12-13 19:07:52,087 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local756232932_0025_m_000000_0 2016-12-13 19:07:52,090 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:52,137 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@2bbddda 2016-12-13 19:07:52,141 INFO [org.apache.hadoop.mapred.MapTask] - Processing split: file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr24/part-r-00000:0+100 2016-12-13 19:07:52,165 INFO [org.apache.hadoop.mapred.MapTask] - (EQUATOR) 0 kvi 26214396(104857584) 2016-12-13 19:07:52,165 INFO [org.apache.hadoop.mapred.MapTask] - mapreduce.task.io.sort.mb: 100 2016-12-13 19:07:52,165 INFO [org.apache.hadoop.mapred.MapTask] - soft limit at 83886080 2016-12-13 19:07:52,165 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufvoid = 104857600 2016-12-13 19:07:52,166 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396; length = 6553600 2016-12-13 19:07:52,167 INFO [org.apache.hadoop.mapred.MapTask] - Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer 2016-12-13 19:07:52,175 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 2016-12-13 19:07:52,175 INFO [org.apache.hadoop.mapred.MapTask] - Starting flush of map output 2016-12-13 19:07:52,175 INFO [org.apache.hadoop.mapred.MapTask] - Spilling map output 2016-12-13 19:07:52,175 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufend = 251; bufvoid = 104857600 2016-12-13 19:07:52,176 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396(104857584); kvend = 26214356(104857424); length = 41/6553600 2016-12-13 19:07:52,193 INFO [org.apache.hadoop.mapred.MapTask] - Finished spill 0 2016-12-13 19:07:52,198 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local756232932_0025_m_000000_0 is done. And is in the process of committing 2016-12-13 19:07:52,203 INFO [org.apache.hadoop.mapred.LocalJobRunner] - file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr24/part-r-00000:0+100 2016-12-13 19:07:52,203 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local756232932_0025_m_000000_0' done. 2016-12-13 19:07:52,204 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local756232932_0025_m_000000_0 2016-12-13 19:07:52,204 INFO [org.apache.hadoop.mapred.LocalJobRunner] - map task executor complete. 2016-12-13 19:07:52,205 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for reduce tasks 2016-12-13 19:07:52,205 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local756232932_0025_r_000000_0 2016-12-13 19:07:52,209 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:52,264 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@74f508b9 2016-12-13 19:07:52,264 INFO [org.apache.hadoop.mapred.ReduceTask] - Using ShuffleConsumerPlugin: org.apache.hadoop.mapreduce.task.reduce.Shuffle@30fe5ac 2016-12-13 19:07:52,266 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - MergerManager: memoryLimit=1327077760, maxSingleShuffleLimit=331769440, mergeThreshold=875871360, ioSortFactor=10, memToMemMergeOutputsThreshold=10 2016-12-13 19:07:52,268 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - attempt_local756232932_0025_r_000000_0 Thread started: EventFetcher for fetching Map Completion Events 2016-12-13 19:07:52,274 INFO [org.apache.hadoop.mapreduce.task.reduce.LocalFetcher] - localfetcher#25 about to shuffle output of map attempt_local756232932_0025_m_000000_0 decomp: 275 len: 279 to MEMORY 2016-12-13 19:07:52,276 INFO [org.apache.hadoop.mapreduce.task.reduce.InMemoryMapOutput] - Read 275 bytes from map-output for attempt_local756232932_0025_m_000000_0 2016-12-13 19:07:52,277 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - closeInMemoryFile -> map-output of size: 275, inMemoryMapOutputs.size() -> 1, commitMemory -> 0, usedMemory ->275 2016-12-13 19:07:52,278 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - EventFetcher is interrupted.. Returning 2016-12-13 19:07:52,280 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:52,280 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - finalMerge called with 1 in-memory map-outputs and 0 on-disk map-outputs 2016-12-13 19:07:52,294 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:52,295 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 271 bytes 2016-12-13 19:07:52,298 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merged 1 segments, 275 bytes to disk to satisfy reduce memory limit 2016-12-13 19:07:52,299 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 1 files, 279 bytes from disk 2016-12-13 19:07:52,299 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 0 segments, 0 bytes from memory into reduce 2016-12-13 19:07:52,300 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:52,301 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 271 bytes 2016-12-13 19:07:52,303 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. *********** new pageRank value is 0.20204150634863857 1___________ *********** new pageRank value is 0.34175921352732863 3___________ *********** new pageRank value is 0.38368802025726273 3___________ *********** new pageRank value is 0.12410468942339331 0___________ 2016-12-13 19:07:52,321 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local756232932_0025_r_000000_0 is done. And is in the process of committing 2016-12-13 19:07:52,326 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:52,327 INFO [org.apache.hadoop.mapred.Task] - Task attempt_local756232932_0025_r_000000_0 is allowed to commit now 2016-12-13 19:07:52,339 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - Saved output of task 'attempt_local756232932_0025_r_000000_0' to file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr25/_temporary/0/task_local756232932_0025_r_000000 2016-12-13 19:07:52,343 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce 2016-12-13 19:07:52,344 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local756232932_0025_r_000000_0' done. 2016-12-13 19:07:52,344 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local756232932_0025_r_000000_0 2016-12-13 19:07:52,346 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce task executor complete. 2016-12-13 19:07:53,080 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local756232932_0025 running in uber mode : false 2016-12-13 19:07:53,081 INFO [org.apache.hadoop.mapreduce.Job] - map 100% reduce 100% 2016-12-13 19:07:53,082 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local756232932_0025 completed successfully 2016-12-13 19:07:53,092 INFO [org.apache.hadoop.mapreduce.Job] - Counters: 34 File System Counters FILE: Number of bytes read=43182 FILE: Number of bytes written=9742963 FILE: Number of read operations=0 FILE: Number of large read operations=0 FILE: Number of write operations=0 Map-Reduce Framework Map input records=4 Map output records=11 Map output bytes=251 Map output materialized bytes=279 Input split bytes=139 Combine input records=0 Combine output records=0 Reduce input groups=4 Reduce shuffle bytes=279 Reduce input records=11 Reduce output records=4 Spilled Records=22 Shuffled Maps =1 Failed Shuffles=0 Merged Map outputs=1 GC time elapsed (ms)=0 CPU time spent (ms)=0 Physical memory (bytes) snapshot=0 Virtual memory (bytes) snapshot=0 Total committed heap usage (bytes)=1774190592 Shuffle Errors BAD_ID=0 CONNECTION=0 IO_ERROR=0 WRONG_LENGTH=0 WRONG_MAP=0 WRONG_REDUCE=0 File Input Format Counters Bytes Read=120 File Output Format Counters Bytes Written=114 zhouls.bigdata.myMapReduce.pagerank.RunJob$Mycounter my=7 success. 7 2016-12-13 19:07:53,109 INFO [org.apache.hadoop.metrics.jvm.JvmMetrics] - Cannot initialize JVM Metrics with processName=JobTracker, sessionId= - already initialized 2016-12-13 19:07:53,116 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this. 2016-12-13 19:07:53,119 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - No job jar file set. User classes may not be found. See Job or Job#setJar(String). 2016-12-13 19:07:53,539 INFO [org.apache.hadoop.mapreduce.lib.input.FileInputFormat] - Total input paths to process : 1 2016-12-13 19:07:53,553 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - number of splits:1 2016-12-13 19:07:53,574 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - Submitting tokens for job: job_local525031809_0026 2016-12-13 19:07:53,728 INFO [org.apache.hadoop.mapreduce.Job] - The url to track the job: http://localhost:8080/ 2016-12-13 19:07:53,729 INFO [org.apache.hadoop.mapreduce.Job] - Running job: job_local525031809_0026 2016-12-13 19:07:53,729 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter set in config null 2016-12-13 19:07:53,730 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter 2016-12-13 19:07:53,736 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for map tasks 2016-12-13 19:07:53,737 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local525031809_0026_m_000000_0 2016-12-13 19:07:53,739 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:53,787 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@4190fa1c 2016-12-13 19:07:53,793 INFO [org.apache.hadoop.mapred.MapTask] - Processing split: file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr25/part-r-00000:0+102 2016-12-13 19:07:53,825 INFO [org.apache.hadoop.mapred.MapTask] - (EQUATOR) 0 kvi 26214396(104857584) 2016-12-13 19:07:53,825 INFO [org.apache.hadoop.mapred.MapTask] - mapreduce.task.io.sort.mb: 100 2016-12-13 19:07:53,826 INFO [org.apache.hadoop.mapred.MapTask] - soft limit at 83886080 2016-12-13 19:07:53,826 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufvoid = 104857600 2016-12-13 19:07:53,826 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396; length = 6553600 2016-12-13 19:07:53,827 INFO [org.apache.hadoop.mapred.MapTask] - Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer 2016-12-13 19:07:53,835 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 2016-12-13 19:07:53,836 INFO [org.apache.hadoop.mapred.MapTask] - Starting flush of map output 2016-12-13 19:07:53,836 INFO [org.apache.hadoop.mapred.MapTask] - Spilling map output 2016-12-13 19:07:53,837 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufend = 258; bufvoid = 104857600 2016-12-13 19:07:53,837 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396(104857584); kvend = 26214356(104857424); length = 41/6553600 2016-12-13 19:07:53,859 INFO [org.apache.hadoop.mapred.MapTask] - Finished spill 0 2016-12-13 19:07:53,864 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local525031809_0026_m_000000_0 is done. And is in the process of committing 2016-12-13 19:07:53,868 INFO [org.apache.hadoop.mapred.LocalJobRunner] - file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr25/part-r-00000:0+102 2016-12-13 19:07:53,869 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local525031809_0026_m_000000_0' done. 2016-12-13 19:07:53,869 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local525031809_0026_m_000000_0 2016-12-13 19:07:53,869 INFO [org.apache.hadoop.mapred.LocalJobRunner] - map task executor complete. 2016-12-13 19:07:53,870 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for reduce tasks 2016-12-13 19:07:53,871 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local525031809_0026_r_000000_0 2016-12-13 19:07:53,874 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:53,929 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@4ab0342e 2016-12-13 19:07:53,930 INFO [org.apache.hadoop.mapred.ReduceTask] - Using ShuffleConsumerPlugin: org.apache.hadoop.mapreduce.task.reduce.Shuffle@7631de50 2016-12-13 19:07:53,932 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - MergerManager: memoryLimit=1327077760, maxSingleShuffleLimit=331769440, mergeThreshold=875871360, ioSortFactor=10, memToMemMergeOutputsThreshold=10 2016-12-13 19:07:53,934 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - attempt_local525031809_0026_r_000000_0 Thread started: EventFetcher for fetching Map Completion Events 2016-12-13 19:07:53,940 INFO [org.apache.hadoop.mapreduce.task.reduce.LocalFetcher] - localfetcher#26 about to shuffle output of map attempt_local525031809_0026_m_000000_0 decomp: 282 len: 286 to MEMORY 2016-12-13 19:07:53,942 INFO [org.apache.hadoop.mapreduce.task.reduce.InMemoryMapOutput] - Read 282 bytes from map-output for attempt_local525031809_0026_m_000000_0 2016-12-13 19:07:53,942 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - closeInMemoryFile -> map-output of size: 282, inMemoryMapOutputs.size() -> 1, commitMemory -> 0, usedMemory ->282 2016-12-13 19:07:53,944 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - EventFetcher is interrupted.. Returning 2016-12-13 19:07:53,946 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:53,947 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - finalMerge called with 1 in-memory map-outputs and 0 on-disk map-outputs 2016-12-13 19:07:53,959 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:53,960 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 278 bytes 2016-12-13 19:07:53,962 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merged 1 segments, 282 bytes to disk to satisfy reduce memory limit 2016-12-13 19:07:53,963 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 1 files, 286 bytes from disk 2016-12-13 19:07:53,963 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 0 segments, 0 bytes from memory into reduce 2016-12-13 19:07:53,963 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:53,964 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 278 bytes 2016-12-13 19:07:53,965 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. *********** new pageRank value is 0.20056740860933667 1___________ *********** new pageRank value is 0.3391795418124502 2___________ *********** new pageRank value is 0.38073982450317145 2___________ *********** new pageRank value is 0.1233676401981714 0___________ 2016-12-13 19:07:53,977 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local525031809_0026_r_000000_0 is done. And is in the process of committing 2016-12-13 19:07:53,981 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:53,981 INFO [org.apache.hadoop.mapred.Task] - Task attempt_local525031809_0026_r_000000_0 is allowed to commit now 2016-12-13 19:07:53,988 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - Saved output of task 'attempt_local525031809_0026_r_000000_0' to file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr26/_temporary/0/task_local525031809_0026_r_000000 2016-12-13 19:07:53,990 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce 2016-12-13 19:07:53,990 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local525031809_0026_r_000000_0' done. 2016-12-13 19:07:53,991 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local525031809_0026_r_000000_0 2016-12-13 19:07:53,991 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce task executor complete. 2016-12-13 19:07:54,729 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local525031809_0026 running in uber mode : false 2016-12-13 19:07:54,730 INFO [org.apache.hadoop.mapreduce.Job] - map 100% reduce 100% 2016-12-13 19:07:54,730 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local525031809_0026 completed successfully 2016-12-13 19:07:54,739 INFO [org.apache.hadoop.mapreduce.Job] - Counters: 34 File System Counters FILE: Number of bytes read=45006 FILE: Number of bytes written=10131824 FILE: Number of read operations=0 FILE: Number of large read operations=0 FILE: Number of write operations=0 Map-Reduce Framework Map input records=4 Map output records=11 Map output bytes=258 Map output materialized bytes=286 Input split bytes=139 Combine input records=0 Combine output records=0 Reduce input groups=4 Reduce shuffle bytes=286 Reduce input records=11 Reduce output records=4 Spilled Records=22 Shuffled Maps =1 Failed Shuffles=0 Merged Map outputs=1 GC time elapsed (ms)=0 CPU time spent (ms)=0 Physical memory (bytes) snapshot=0 Virtual memory (bytes) snapshot=0 Total committed heap usage (bytes)=1774190592 Shuffle Errors BAD_ID=0 CONNECTION=0 IO_ERROR=0 WRONG_LENGTH=0 WRONG_MAP=0 WRONG_REDUCE=0 File Input Format Counters Bytes Read=122 File Output Format Counters Bytes Written=112 zhouls.bigdata.myMapReduce.pagerank.RunJob$Mycounter my=5 success. 5 2016-12-13 19:07:54,749 INFO [org.apache.hadoop.metrics.jvm.JvmMetrics] - Cannot initialize JVM Metrics with processName=JobTracker, sessionId= - already initialized 2016-12-13 19:07:54,756 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this. 2016-12-13 19:07:54,759 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - No job jar file set. User classes may not be found. See Job or Job#setJar(String). 2016-12-13 19:07:55,178 INFO [org.apache.hadoop.mapreduce.lib.input.FileInputFormat] - Total input paths to process : 1 2016-12-13 19:07:55,190 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - number of splits:1 2016-12-13 19:07:55,211 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - Submitting tokens for job: job_local582978068_0027 2016-12-13 19:07:55,356 INFO [org.apache.hadoop.mapreduce.Job] - The url to track the job: http://localhost:8080/ 2016-12-13 19:07:55,357 INFO [org.apache.hadoop.mapreduce.Job] - Running job: job_local582978068_0027 2016-12-13 19:07:55,357 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter set in config null 2016-12-13 19:07:55,358 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter 2016-12-13 19:07:55,366 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for map tasks 2016-12-13 19:07:55,367 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local582978068_0027_m_000000_0 2016-12-13 19:07:55,371 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:55,428 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@4b81e280 2016-12-13 19:07:55,432 INFO [org.apache.hadoop.mapred.MapTask] - Processing split: file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr26/part-r-00000:0+100 2016-12-13 19:07:55,459 INFO [org.apache.hadoop.mapred.MapTask] - (EQUATOR) 0 kvi 26214396(104857584) 2016-12-13 19:07:55,459 INFO [org.apache.hadoop.mapred.MapTask] - mapreduce.task.io.sort.mb: 100 2016-12-13 19:07:55,459 INFO [org.apache.hadoop.mapred.MapTask] - soft limit at 83886080 2016-12-13 19:07:55,459 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufvoid = 104857600 2016-12-13 19:07:55,459 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396; length = 6553600 2016-12-13 19:07:55,461 INFO [org.apache.hadoop.mapred.MapTask] - Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer 2016-12-13 19:07:55,469 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 2016-12-13 19:07:55,470 INFO [org.apache.hadoop.mapred.MapTask] - Starting flush of map output 2016-12-13 19:07:55,470 INFO [org.apache.hadoop.mapred.MapTask] - Spilling map output 2016-12-13 19:07:55,470 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufend = 251; bufvoid = 104857600 2016-12-13 19:07:55,471 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396(104857584); kvend = 26214356(104857424); length = 41/6553600 2016-12-13 19:07:55,486 INFO [org.apache.hadoop.mapred.MapTask] - Finished spill 0 2016-12-13 19:07:55,493 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local582978068_0027_m_000000_0 is done. And is in the process of committing 2016-12-13 19:07:55,499 INFO [org.apache.hadoop.mapred.LocalJobRunner] - file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr26/part-r-00000:0+100 2016-12-13 19:07:55,500 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local582978068_0027_m_000000_0' done. 2016-12-13 19:07:55,500 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local582978068_0027_m_000000_0 2016-12-13 19:07:55,501 INFO [org.apache.hadoop.mapred.LocalJobRunner] - map task executor complete. 2016-12-13 19:07:55,502 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for reduce tasks 2016-12-13 19:07:55,502 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local582978068_0027_r_000000_0 2016-12-13 19:07:55,507 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:55,570 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@314779f4 2016-12-13 19:07:55,571 INFO [org.apache.hadoop.mapred.ReduceTask] - Using ShuffleConsumerPlugin: org.apache.hadoop.mapreduce.task.reduce.Shuffle@4b979b72 2016-12-13 19:07:55,573 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - MergerManager: memoryLimit=1327077760, maxSingleShuffleLimit=331769440, mergeThreshold=875871360, ioSortFactor=10, memToMemMergeOutputsThreshold=10 2016-12-13 19:07:55,577 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - attempt_local582978068_0027_r_000000_0 Thread started: EventFetcher for fetching Map Completion Events 2016-12-13 19:07:55,587 INFO [org.apache.hadoop.mapreduce.task.reduce.LocalFetcher] - localfetcher#27 about to shuffle output of map attempt_local582978068_0027_m_000000_0 decomp: 275 len: 279 to MEMORY 2016-12-13 19:07:55,589 INFO [org.apache.hadoop.mapreduce.task.reduce.InMemoryMapOutput] - Read 275 bytes from map-output for attempt_local582978068_0027_m_000000_0 2016-12-13 19:07:55,590 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - closeInMemoryFile -> map-output of size: 275, inMemoryMapOutputs.size() -> 1, commitMemory -> 0, usedMemory ->275 2016-12-13 19:07:55,591 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - EventFetcher is interrupted.. Returning 2016-12-13 19:07:55,595 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:55,595 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - finalMerge called with 1 in-memory map-outputs and 0 on-disk map-outputs 2016-12-13 19:07:55,609 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:55,609 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 271 bytes 2016-12-13 19:07:55,611 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merged 1 segments, 275 bytes to disk to satisfy reduce memory limit 2016-12-13 19:07:55,613 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 1 files, 279 bytes from disk 2016-12-13 19:07:55,613 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 0 segments, 0 bytes from memory into reduce 2016-12-13 19:07:55,613 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:55,614 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 271 bytes 2016-12-13 19:07:55,616 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. *********** new pageRank value is 0.19931442541384786 1___________ *********** new pageRank value is 0.33698682115703876 2___________ *********** new pageRank value is 0.37823385762480544 2___________ *********** new pageRank value is 0.12274114865896807 0___________ 2016-12-13 19:07:55,636 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local582978068_0027_r_000000_0 is done. And is in the process of committing 2016-12-13 19:07:55,640 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:55,640 INFO [org.apache.hadoop.mapred.Task] - Task attempt_local582978068_0027_r_000000_0 is allowed to commit now 2016-12-13 19:07:55,649 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - Saved output of task 'attempt_local582978068_0027_r_000000_0' to file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr27/_temporary/0/task_local582978068_0027_r_000000 2016-12-13 19:07:55,657 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce 2016-12-13 19:07:55,657 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local582978068_0027_r_000000_0' done. 2016-12-13 19:07:55,658 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local582978068_0027_r_000000_0 2016-12-13 19:07:55,658 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce task executor complete. 2016-12-13 19:07:56,357 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local582978068_0027 running in uber mode : false 2016-12-13 19:07:56,358 INFO [org.apache.hadoop.mapreduce.Job] - map 100% reduce 100% 2016-12-13 19:07:56,359 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local582978068_0027 completed successfully 2016-12-13 19:07:56,366 INFO [org.apache.hadoop.mapreduce.Job] - Counters: 34 File System Counters FILE: Number of bytes read=46826 FILE: Number of bytes written=10520671 FILE: Number of read operations=0 FILE: Number of large read operations=0 FILE: Number of write operations=0 Map-Reduce Framework Map input records=4 Map output records=11 Map output bytes=251 Map output materialized bytes=279 Input split bytes=139 Combine input records=0 Combine output records=0 Reduce input groups=4 Reduce shuffle bytes=279 Reduce input records=11 Reduce output records=4 Spilled Records=22 Shuffled Maps =1 Failed Shuffles=0 Merged Map outputs=1 GC time elapsed (ms)=0 CPU time spent (ms)=0 Physical memory (bytes) snapshot=0 Virtual memory (bytes) snapshot=0 Total committed heap usage (bytes)=1889533952 Shuffle Errors BAD_ID=0 CONNECTION=0 IO_ERROR=0 WRONG_LENGTH=0 WRONG_MAP=0 WRONG_REDUCE=0 File Input Format Counters Bytes Read=120 File Output Format Counters Bytes Written=114 zhouls.bigdata.myMapReduce.pagerank.RunJob$Mycounter my=5 success. 5 2016-12-13 19:07:56,374 INFO [org.apache.hadoop.metrics.jvm.JvmMetrics] - Cannot initialize JVM Metrics with processName=JobTracker, sessionId= - already initialized 2016-12-13 19:07:56,384 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this. 2016-12-13 19:07:56,386 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - No job jar file set. User classes may not be found. See Job or Job#setJar(String). 2016-12-13 19:07:56,854 INFO [org.apache.hadoop.mapreduce.lib.input.FileInputFormat] - Total input paths to process : 1 2016-12-13 19:07:56,866 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - number of splits:1 2016-12-13 19:07:56,880 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - Submitting tokens for job: job_local1006109257_0028 2016-12-13 19:07:57,050 INFO [org.apache.hadoop.mapreduce.Job] - The url to track the job: http://localhost:8080/ 2016-12-13 19:07:57,051 INFO [org.apache.hadoop.mapreduce.Job] - Running job: job_local1006109257_0028 2016-12-13 19:07:57,051 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter set in config null 2016-12-13 19:07:57,052 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter 2016-12-13 19:07:57,059 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for map tasks 2016-12-13 19:07:57,059 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local1006109257_0028_m_000000_0 2016-12-13 19:07:57,062 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:57,114 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@753f2425 2016-12-13 19:07:57,118 INFO [org.apache.hadoop.mapred.MapTask] - Processing split: file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr27/part-r-00000:0+102 2016-12-13 19:07:57,152 INFO [org.apache.hadoop.mapred.MapTask] - (EQUATOR) 0 kvi 26214396(104857584) 2016-12-13 19:07:57,152 INFO [org.apache.hadoop.mapred.MapTask] - mapreduce.task.io.sort.mb: 100 2016-12-13 19:07:57,152 INFO [org.apache.hadoop.mapred.MapTask] - soft limit at 83886080 2016-12-13 19:07:57,153 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufvoid = 104857600 2016-12-13 19:07:57,153 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396; length = 6553600 2016-12-13 19:07:57,154 INFO [org.apache.hadoop.mapred.MapTask] - Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer 2016-12-13 19:07:57,162 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 2016-12-13 19:07:57,163 INFO [org.apache.hadoop.mapred.MapTask] - Starting flush of map output 2016-12-13 19:07:57,163 INFO [org.apache.hadoop.mapred.MapTask] - Spilling map output 2016-12-13 19:07:57,163 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufend = 258; bufvoid = 104857600 2016-12-13 19:07:57,163 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396(104857584); kvend = 26214356(104857424); length = 41/6553600 2016-12-13 19:07:57,175 INFO [org.apache.hadoop.mapred.MapTask] - Finished spill 0 2016-12-13 19:07:57,179 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local1006109257_0028_m_000000_0 is done. And is in the process of committing 2016-12-13 19:07:57,183 INFO [org.apache.hadoop.mapred.LocalJobRunner] - file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr27/part-r-00000:0+102 2016-12-13 19:07:57,183 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local1006109257_0028_m_000000_0' done. 2016-12-13 19:07:57,184 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local1006109257_0028_m_000000_0 2016-12-13 19:07:57,184 INFO [org.apache.hadoop.mapred.LocalJobRunner] - map task executor complete. 2016-12-13 19:07:57,185 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for reduce tasks 2016-12-13 19:07:57,185 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local1006109257_0028_r_000000_0 2016-12-13 19:07:57,188 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:57,237 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@b901239 2016-12-13 19:07:57,237 INFO [org.apache.hadoop.mapred.ReduceTask] - Using ShuffleConsumerPlugin: org.apache.hadoop.mapreduce.task.reduce.Shuffle@1f9c621d 2016-12-13 19:07:57,239 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - MergerManager: memoryLimit=1327077760, maxSingleShuffleLimit=331769440, mergeThreshold=875871360, ioSortFactor=10, memToMemMergeOutputsThreshold=10 2016-12-13 19:07:57,242 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - attempt_local1006109257_0028_r_000000_0 Thread started: EventFetcher for fetching Map Completion Events 2016-12-13 19:07:57,246 INFO [org.apache.hadoop.mapreduce.task.reduce.LocalFetcher] - localfetcher#28 about to shuffle output of map attempt_local1006109257_0028_m_000000_0 decomp: 282 len: 286 to MEMORY 2016-12-13 19:07:57,247 INFO [org.apache.hadoop.mapreduce.task.reduce.InMemoryMapOutput] - Read 282 bytes from map-output for attempt_local1006109257_0028_m_000000_0 2016-12-13 19:07:57,247 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - closeInMemoryFile -> map-output of size: 282, inMemoryMapOutputs.size() -> 1, commitMemory -> 0, usedMemory ->282 2016-12-13 19:07:57,248 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - EventFetcher is interrupted.. Returning 2016-12-13 19:07:57,250 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:57,250 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - finalMerge called with 1 in-memory map-outputs and 0 on-disk map-outputs 2016-12-13 19:07:57,259 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:57,260 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 278 bytes 2016-12-13 19:07:57,263 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merged 1 segments, 282 bytes to disk to satisfy reduce memory limit 2016-12-13 19:07:57,263 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 1 files, 286 bytes from disk 2016-12-13 19:07:57,264 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 0 segments, 0 bytes from memory into reduce 2016-12-13 19:07:57,264 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:57,265 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 278 bytes 2016-12-13 19:07:57,266 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. *********** new pageRank value is 0.1982493894905423 1___________ *********** new pageRank value is 0.33512300847148907 1___________ *********** new pageRank value is 0.3761037861635444 2___________ *********** new pageRank value is 0.12220863080088534 0___________ 2016-12-13 19:07:57,280 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local1006109257_0028_r_000000_0 is done. And is in the process of committing 2016-12-13 19:07:57,284 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:57,284 INFO [org.apache.hadoop.mapred.Task] - Task attempt_local1006109257_0028_r_000000_0 is allowed to commit now 2016-12-13 19:07:57,295 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - Saved output of task 'attempt_local1006109257_0028_r_000000_0' to file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr28/_temporary/0/task_local1006109257_0028_r_000000 2016-12-13 19:07:57,299 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce 2016-12-13 19:07:57,299 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local1006109257_0028_r_000000_0' done. 2016-12-13 19:07:57,299 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local1006109257_0028_r_000000_0 2016-12-13 19:07:57,300 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce task executor complete. 2016-12-13 19:07:58,051 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local1006109257_0028 running in uber mode : false 2016-12-13 19:07:58,052 INFO [org.apache.hadoop.mapreduce.Job] - map 100% reduce 100% 2016-12-13 19:07:58,053 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local1006109257_0028 completed successfully 2016-12-13 19:07:58,057 INFO [org.apache.hadoop.mapreduce.Job] - Counters: 34 File System Counters FILE: Number of bytes read=48650 FILE: Number of bytes written=10911508 FILE: Number of read operations=0 FILE: Number of large read operations=0 FILE: Number of write operations=0 Map-Reduce Framework Map input records=4 Map output records=11 Map output bytes=258 Map output materialized bytes=286 Input split bytes=139 Combine input records=0 Combine output records=0 Reduce input groups=4 Reduce shuffle bytes=286 Reduce input records=11 Reduce output records=4 Spilled Records=22 Shuffled Maps =1 Failed Shuffles=0 Merged Map outputs=1 GC time elapsed (ms)=0 CPU time spent (ms)=0 Physical memory (bytes) snapshot=0 Virtual memory (bytes) snapshot=0 Total committed heap usage (bytes)=1889533952 Shuffle Errors BAD_ID=0 CONNECTION=0 IO_ERROR=0 WRONG_LENGTH=0 WRONG_MAP=0 WRONG_REDUCE=0 File Input Format Counters Bytes Read=122 File Output Format Counters Bytes Written=112 zhouls.bigdata.myMapReduce.pagerank.RunJob$Mycounter my=4 success. 4 2016-12-13 19:07:58,066 INFO [org.apache.hadoop.metrics.jvm.JvmMetrics] - Cannot initialize JVM Metrics with processName=JobTracker, sessionId= - already initialized 2016-12-13 19:07:58,073 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - Hadoop command-line option parsing not performed. Implement the Tool interface and execute your application with ToolRunner to remedy this. 2016-12-13 19:07:58,076 WARN [org.apache.hadoop.mapreduce.JobSubmitter] - No job jar file set. User classes may not be found. See Job or Job#setJar(String). 2016-12-13 19:07:58,528 INFO [org.apache.hadoop.mapreduce.lib.input.FileInputFormat] - Total input paths to process : 1 2016-12-13 19:07:58,540 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - number of splits:1 2016-12-13 19:07:58,559 INFO [org.apache.hadoop.mapreduce.JobSubmitter] - Submitting tokens for job: job_local626952993_0029 2016-12-13 19:07:58,716 INFO [org.apache.hadoop.mapreduce.Job] - The url to track the job: http://localhost:8080/ 2016-12-13 19:07:58,717 INFO [org.apache.hadoop.mapreduce.Job] - Running job: job_local626952993_0029 2016-12-13 19:07:58,717 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter set in config null 2016-12-13 19:07:58,718 INFO [org.apache.hadoop.mapred.LocalJobRunner] - OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter 2016-12-13 19:07:58,725 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for map tasks 2016-12-13 19:07:58,726 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local626952993_0029_m_000000_0 2016-12-13 19:07:58,728 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:58,780 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@3e0a19cb 2016-12-13 19:07:58,784 INFO [org.apache.hadoop.mapred.MapTask] - Processing split: file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr28/part-r-00000:0+100 2016-12-13 19:07:58,831 INFO [org.apache.hadoop.mapred.MapTask] - (EQUATOR) 0 kvi 26214396(104857584) 2016-12-13 19:07:58,831 INFO [org.apache.hadoop.mapred.MapTask] - mapreduce.task.io.sort.mb: 100 2016-12-13 19:07:58,831 INFO [org.apache.hadoop.mapred.MapTask] - soft limit at 83886080 2016-12-13 19:07:58,832 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufvoid = 104857600 2016-12-13 19:07:58,832 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396; length = 6553600 2016-12-13 19:07:58,833 INFO [org.apache.hadoop.mapred.MapTask] - Map output collector class = org.apache.hadoop.mapred.MapTask$MapOutputBuffer 2016-12-13 19:07:58,839 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 2016-12-13 19:07:58,839 INFO [org.apache.hadoop.mapred.MapTask] - Starting flush of map output 2016-12-13 19:07:58,840 INFO [org.apache.hadoop.mapred.MapTask] - Spilling map output 2016-12-13 19:07:58,840 INFO [org.apache.hadoop.mapred.MapTask] - bufstart = 0; bufend = 252; bufvoid = 104857600 2016-12-13 19:07:58,840 INFO [org.apache.hadoop.mapred.MapTask] - kvstart = 26214396(104857584); kvend = 26214356(104857424); length = 41/6553600 2016-12-13 19:07:58,853 INFO [org.apache.hadoop.mapred.MapTask] - Finished spill 0 2016-12-13 19:07:58,858 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local626952993_0029_m_000000_0 is done. And is in the process of committing 2016-12-13 19:07:58,863 INFO [org.apache.hadoop.mapred.LocalJobRunner] - file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr28/part-r-00000:0+100 2016-12-13 19:07:58,863 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local626952993_0029_m_000000_0' done. 2016-12-13 19:07:58,864 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local626952993_0029_m_000000_0 2016-12-13 19:07:58,864 INFO [org.apache.hadoop.mapred.LocalJobRunner] - map task executor complete. 2016-12-13 19:07:58,865 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Waiting for reduce tasks 2016-12-13 19:07:58,866 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Starting task: attempt_local626952993_0029_r_000000_0 2016-12-13 19:07:58,870 INFO [org.apache.hadoop.yarn.util.ProcfsBasedProcessTree] - ProcfsBasedProcessTree currently is supported only on Linux. 2016-12-13 19:07:58,926 INFO [org.apache.hadoop.mapred.Task] - Using ResourceCalculatorProcessTree : org.apache.hadoop.yarn.util.WindowsBasedProcessTree@6f36ac8a 2016-12-13 19:07:58,926 INFO [org.apache.hadoop.mapred.ReduceTask] - Using ShuffleConsumerPlugin: org.apache.hadoop.mapreduce.task.reduce.Shuffle@6e79d110 2016-12-13 19:07:58,928 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - MergerManager: memoryLimit=1327077760, maxSingleShuffleLimit=331769440, mergeThreshold=875871360, ioSortFactor=10, memToMemMergeOutputsThreshold=10 2016-12-13 19:07:58,930 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - attempt_local626952993_0029_r_000000_0 Thread started: EventFetcher for fetching Map Completion Events 2016-12-13 19:07:58,935 INFO [org.apache.hadoop.mapreduce.task.reduce.LocalFetcher] - localfetcher#29 about to shuffle output of map attempt_local626952993_0029_m_000000_0 decomp: 276 len: 280 to MEMORY 2016-12-13 19:07:58,936 INFO [org.apache.hadoop.mapreduce.task.reduce.InMemoryMapOutput] - Read 276 bytes from map-output for attempt_local626952993_0029_m_000000_0 2016-12-13 19:07:58,937 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - closeInMemoryFile -> map-output of size: 276, inMemoryMapOutputs.size() -> 1, commitMemory -> 0, usedMemory ->276 2016-12-13 19:07:58,938 INFO [org.apache.hadoop.mapreduce.task.reduce.EventFetcher] - EventFetcher is interrupted.. Returning 2016-12-13 19:07:58,940 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:58,940 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - finalMerge called with 1 in-memory map-outputs and 0 on-disk map-outputs 2016-12-13 19:07:58,949 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:58,949 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 272 bytes 2016-12-13 19:07:58,952 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merged 1 segments, 276 bytes to disk to satisfy reduce memory limit 2016-12-13 19:07:58,953 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 1 files, 280 bytes from disk 2016-12-13 19:07:58,953 INFO [org.apache.hadoop.mapreduce.task.reduce.MergeManagerImpl] - Merging 0 segments, 0 bytes from memory into reduce 2016-12-13 19:07:58,954 INFO [org.apache.hadoop.mapred.Merger] - Merging 1 sorted segments 2016-12-13 19:07:58,954 INFO [org.apache.hadoop.mapred.Merger] - Down to the last merge-pass, with 1 segments left of total size: 272 bytes 2016-12-13 19:07:58,956 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. *********** new pageRank value is 0.19734410911950637 0___________ *********** new pageRank value is 0.33353876774336305 1___________ *********** new pageRank value is 0.37429322529114195 1___________ *********** new pageRank value is 0.12175599053348046 0___________ 2016-12-13 19:07:58,969 INFO [org.apache.hadoop.mapred.Task] - Task:attempt_local626952993_0029_r_000000_0 is done. And is in the process of committing 2016-12-13 19:07:58,978 INFO [org.apache.hadoop.mapred.LocalJobRunner] - 1 / 1 copied. 2016-12-13 19:07:58,979 INFO [org.apache.hadoop.mapred.Task] - Task attempt_local626952993_0029_r_000000_0 is allowed to commit now 2016-12-13 19:07:58,996 INFO [org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter] - Saved output of task 'attempt_local626952993_0029_r_000000_0' to file:/D:/Code/MyEclipseJavaCode/myMapReduce/out/pagerank/pr29/_temporary/0/task_local626952993_0029_r_000000 2016-12-13 19:07:58,999 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce > reduce 2016-12-13 19:07:58,999 INFO [org.apache.hadoop.mapred.Task] - Task 'attempt_local626952993_0029_r_000000_0' done. 2016-12-13 19:07:58,999 INFO [org.apache.hadoop.mapred.LocalJobRunner] - Finishing task: attempt_local626952993_0029_r_000000_0 2016-12-13 19:07:58,999 INFO [org.apache.hadoop.mapred.LocalJobRunner] - reduce task executor complete. 2016-12-13 19:07:59,717 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local626952993_0029 running in uber mode : false 2016-12-13 19:07:59,718 INFO [org.apache.hadoop.mapreduce.Job] - map 100% reduce 100% 2016-12-13 19:07:59,719 INFO [org.apache.hadoop.mapreduce.Job] - Job job_local626952993_0029 completed successfully 2016-12-13 19:07:59,728 INFO [org.apache.hadoop.mapreduce.Job] - Counters: 34 File System Counters FILE: Number of bytes read=50472 FILE: Number of bytes written=11300358 FILE: Number of read operations=0 FILE: Number of large read operations=0 FILE: Number of write operations=0 Map-Reduce Framework Map input records=4 Map output records=11 Map output bytes=252 Map output materialized bytes=280 Input split bytes=139 Combine input records=0 Combine output records=0 Reduce input groups=4 Reduce shuffle bytes=280 Reduce input records=11 Reduce output records=4 Spilled Records=22 Shuffled Maps =1 Failed Shuffles=0 Merged Map outputs=1 GC time elapsed (ms)=21 CPU time spent (ms)=0 Physical memory (bytes) snapshot=0 Virtual memory (bytes) snapshot=0 Total committed heap usage (bytes)=1901068288 Shuffle Errors BAD_ID=0 CONNECTION=0 IO_ERROR=0 WRONG_LENGTH=0 WRONG_MAP=0 WRONG_REDUCE=0 File Input Format Counters Bytes Read=120 File Output Format Counters Bytes Written=114 zhouls.bigdata.myMapReduce.pagerank.RunJob$Mycounter my=2 success. 2 代码 package zhouls.bigdata.myMapReduce.pagerank; //pr值 import java.io.IOException; import java.util.Arrays; import org.apache.commons.lang.StringUtils; public class Node { private double pageRank=1.0; private String[] adjacentNodeNames; public static final char fieldSeparator = '\t';//分隔符 public double getPageRank() { return pageRank; } public Node setPageRank(double pageRank) { this.pageRank = pageRank; return this; } public String[] getAdjacentNodeNames() { return adjacentNodeNames; } public Node setAdjacentNodeNames(String[] adjacentNodeNames) { this.adjacentNodeNames = adjacentNodeNames; return this; }//这一大段的get和set,可以右键,source,产生get和set,自动生成。 public boolean containsAdjacentNodes() { return adjacentNodeNames != null && adjacentNodeNames.length>0; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(pageRank); if (getAdjacentNodeNames() != null) { sb.append(fieldSeparator) .append(StringUtils .join(getAdjacentNodeNames(), fieldSeparator)); } return sb.toString(); } //value =1.0 B D public static Node fromMR(String value) throws IOException { String[] parts = StringUtils.splitPreserveAllTokens( value, fieldSeparator); if (parts.length < 1) { throw new IOException( "Expected 1 or more parts but received " + parts.length); } Node node = new Node() .setPageRank(Double.valueOf(parts[0])); if (parts.length > 1) { node.setAdjacentNodeNames(Arrays.copyOfRange(parts, 1, parts.length)); } return node; } } package zhouls.bigdata.myMapReduce.pagerank;//网页排名 import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.Mapper; import org.apache.hadoop.mapreduce.Reducer; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.KeyValueTextInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; public class RunJob { public static enum Mycounter{ my } public static void main(String[] args) { Configuration config =new Configuration(); // config.set("fs.defaultFS", "hdfs://HadoopMaster:9000"); // config.set("yarn.resourcemanager.hostname", "HadoopMaster"); double d =0.001; int i=0; while(true){ i++; try { config.setInt("runCount", i); FileSystem fs =FileSystem.get(config); Job job =Job.getInstance(config); job.setJarByClass(RunJob.class); job.setJobName("pr"+i); job.setMapperClass(PageRankMapper.class); job.setReducerClass(PageRankReducer.class); job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(Text.class); job.setInputFormatClass(KeyValueTextInputFormat.class); // Path inputPath =new Path("hdfs://HadoopMaster:9000/pagerank/pagerank.txt"); Path inputPath =new Path("./data/pagerank/pagerank.txt"); if(i>1){ // inputPath =new Path("hdfs://HadoopMaster:9000/out/pagerank/pr"+(i-1)); inputPath =new Path("./out/pagerank/pr"+(i-1)); } FileInputFormat.addInputPath(job, inputPath); // Path outpath =new Path("hdfs://HadoopMaster:9000/out/pagerank/pr"+i); Path outpath =new Path("./out/pagerank/pr"+i); if(fs.exists(outpath)){ fs.delete(outpath, true); } FileOutputFormat.setOutputPath(job, outpath); boolean f= job.waitForCompletion(true); if(f){ System.out.println("success."); long sum= job.getCounters().findCounter(Mycounter.my).getValue(); System.out.println(sum); double avgd= sum/4000.0; if(avgd<d){ break; } } } catch (Exception e) { e.printStackTrace(); } } } static class PageRankMapper extends Mapper<Text, Text, Text, Text>{ protected void map(Text key, Text value, Context context) throws IOException, InterruptedException { int runCount= context.getConfiguration().getInt("runCount", 1); String page =key.toString(); Node node =null; if(runCount==1){ node =Node.fromMR("1.0"+"\t"+value.toString()); }else{ node =Node.fromMR(value.toString()); } context.write(new Text(page), new Text(node.toString()));//A:1.0 B D if(node.containsAdjacentNodes()){ double outValue =node.getPageRank()/node.getAdjacentNodeNames().length; for (int i = 0; i < node.getAdjacentNodeNames().length; i++) { String outPage = node.getAdjacentNodeNames()[i]; context.write(new Text(outPage), new Text(outValue+""));//B:0.5 D:0.5 } } } } static class PageRankReducer extends Reducer<Text, Text, Text, Text>{ protected void reduce(Text arg0, Iterable<Text> arg1, Context arg2) throws IOException, InterruptedException { double sum =0.0; Node sourceNode =null; for(Text i:arg1){ Node node =Node.fromMR(i.toString()); if(node.containsAdjacentNodes()){ sourceNode =node; }else{ sum=sum+node.getPageRank(); } } double newPR=(0.15/4)+(0.85*sum); System.out.println("*********** new pageRank value is "+newPR); //把新的pr值和计算之前的pr比较 double d= newPR -sourceNode.getPageRank(); int j=(int)( d*1000.0); j=Math.abs(j); System.out.println(j+"___________"); arg2.getCounter(Mycounter.my).increment(j);; sourceNode.setPageRank(newPR); arg2.write(arg0, new Text(sourceNode.toString())); } } } 本文转自大数据躺过的坑博客园博客,原文链接:http://www.cnblogs.com/zlslch/p/6171162.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

HBase编程 API入门系列之delete(客户端而言)(3)

hbase(main):001:0>scan 'test_table2' ROW COLUMN+CELL row_04 column=f1:name, timestamp=1478117286377, value=Andy3 row_04 column=f2:name, timestamp=1478117286377, value=Andy3 1 row(s) in 1.5670 seconds hbase(main):002:0> 如现在这样,不指定,默认把所有的列全会删除 (开发实际中,一定要加指定呀) 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.HBaseConfiguration; 7 import org.apache.hadoop.hbase.TableName; 8 import org.apache.hadoop.hbase.client.Delete; 9 import org.apache.hadoop.hbase.client.Get; 10 import org.apache.hadoop.hbase.client.HTable; 11 import org.apache.hadoop.hbase.client.Put; 12 import org.apache.hadoop.hbase.util.Bytes; 13 14 public class HBaseTest { 15 public static void main(String[] args) throws Exception { 16 HTable table = new HTable(getConfig(),TableName.valueOf("test_table2"));//表名是test_table 17 // Put put = new Put(Bytes.toBytes("row_04"));//行键是row_01 18 // put.add(Bytes.toBytes("f1"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f1,列修饰符是name,值是Andy3 19 // put.add(Bytes.toBytes("f2"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f2,列修饰符是name,值是Andy3 20 // table.put(put); 21 22 // Get get = new Get(Bytes.toBytes("row_04")); 23 // get.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("age"));如现在这样,不指定,默认把所有的全拿出来 24 // org.apache.hadoop.hbase.client.Result rest = table.get(get); 25 // System.out.println(rest.toString()); 26 // table.close(); 27 28 Delete delete = new Delete(Bytes.toBytes("row_04")); 29 table.delete(delete); 30 table.close(); 31 } 32 33 public static Configuration getConfig(){ 34 Configuration configuration = new Configuration(); 35 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 36 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 37 return configuration; 38 } 39 } 2016-12-10 15:37:29,818 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x5fc2fc59 connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 15:37:29,838 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 15:37:29,838 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 15:37:29,839 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 15:37:29,839 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 15:37:29,839 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 15:37:29,839 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 15:37:29,840 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 15:37:29,842 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 15:37:29,842 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 15:37:29,842 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 15:37:29,843 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 15:37:29,843 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 15:37:29,844 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 15:37:29,844 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 15:37:29,844 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 15:37:29,847 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x5fc2fc590x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 15:37:29,925 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopSlave1/192.168.80.11:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 15:37:29,971 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopSlave1/192.168.80.11:2181, initiating session 2016-12-10 15:37:29,996 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopSlave1/192.168.80.11:2181, sessionid = 0x2587338ecb4000e, negotiated timeout = 40000 2016-12-10 15:37:31,324 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x2587338ecb4000e 2016-12-10 15:37:31,340 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x2587338ecb4000e closed 2016-12-10 15:37:31,344 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down hbase(main):001:0>scan 'test_table2' ROW COLUMN+CELL row_04 column=f1:name, timestamp=1478117286377, value=Andy3 row_04 column=f2:name, timestamp=1478117286377, value=Andy3 1 row(s) in 1.5670 seconds hbase(main):002:0>scan 'test_table2' ROW COLUMN+CELL 0 row(s) in 0.1720 seconds hbase(main):003:0> hbase(main):003:0>put 'test_table2','row_1','f1:name','andy' 0 row(s) in 0.6390 seconds hbase(main):004:0>put 'test_table2','row_1','f1:age','25' 0 row(s) in 0.0630 seconds hbase(main):005:0>put 'test_table2','row_1','f1:email','10086@qq.com' 0 row(s) in 0.2040 seconds hbase(main):006:0>scan 'test_table2' ROW COLUMN+CELL row_1 column=f1:age, timestamp=1478119757136, value=25 row_1 column=f1:email, timestamp=1478119978163, value=10086@qq.com row_1 column=f1:name, timestamp=1478119459805, value=andy 1 row(s) in 0.1000 seconds hbase(main):007:0>put 'test_table2','row_2','f1:email','10086@qq.com' 0 row(s) in 0.0290 seconds hbase(main):008:0>put 'test_table2','row_2','f1:name','maizi' 0 row(s) in 0.0940 seconds hbase(main):009:0>scan 'test_table2' ROW COLUMN+CELL row_1 column=f1:age, timestamp=1478119757136, value=25 row_1 column=f1:email, timestamp=1478119978163, value=10086@qq.com row_1 column=f1:name, timestamp=1478119459805, value=andy row_2 column=f1:email, timestamp=1478120078440, value=10086@qq.com row_2 column=f1:name, timestamp=1478120133536, value=maizi 2 row(s) in 0.1280 seconds hbase(main):010:0> 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.HBaseConfiguration; 7 import org.apache.hadoop.hbase.TableName; 8 import org.apache.hadoop.hbase.client.Delete; 9 import org.apache.hadoop.hbase.client.Get; 10 import org.apache.hadoop.hbase.client.HTable; 11 import org.apache.hadoop.hbase.client.Put; 12 import org.apache.hadoop.hbase.util.Bytes; 13 14 public class HBaseTest { 15 public static void main(String[] args) throws Exception { 16 HTable table = new HTable(getConfig(),TableName.valueOf("test_table2"));//表名是test_table 17 // Put put = new Put(Bytes.toBytes("row_04"));//行键是row_01 18 // put.add(Bytes.toBytes("f1"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f1,列修饰符是name,值是Andy3 19 // put.add(Bytes.toBytes("f2"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f2,列修饰符是name,值是Andy3 20 // table.put(put); 21 22 // Get get = new Get(Bytes.toBytes("row_04")); 23 // get.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("age"));如现在这样,不指定,默认把所有的全拿出来 24 // org.apache.hadoop.hbase.client.Result rest = table.get(get); 25 // System.out.println(rest.toString()); 26 // table.close(); 27 28 Delete delete = new Delete(Bytes.toBytes("row_1")); 29 delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("email")); 30 table.delete(delete); 31 table.close(); 32 } 33 34 public static Configuration getConfig(){ 35 Configuration configuration = new Configuration(); 36 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 37 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 38 return configuration; 39 } 40 } 2016-12-10 16:01:36,462 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x27758c30 connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 16:01:36,493 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 16:01:36,493 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 16:01:36,493 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 16:01:36,494 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 16:01:36,494 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 16:01:36,494 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 16:01:36,495 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 16:01:36,496 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 16:01:36,496 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 16:01:36,496 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 16:01:36,496 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 16:01:36,496 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 16:01:36,496 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 16:01:36,497 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 16:01:36,497 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 16:01:36,500 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x27758c300x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 16:01:36,664 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopMaster/192.168.80.10:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 16:01:36,679 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopMaster/192.168.80.10:2181, initiating session 2016-12-10 16:01:36,764 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopMaster/192.168.80.10:2181, sessionid = 0x15825dedcf4000f, negotiated timeout = 40000 2016-12-10 16:01:38,454 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x15825dedcf4000f 2016-12-10 16:01:38,461 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x15825dedcf4000f closed 2016-12-10 16:01:38,461 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down hbase(main):015:0>scan 'test_table2' ROW COLUMN+CELL row_1 column=f1:age, timestamp=1478119757136, value=25 row_1 column=f1:email, timestamp=1478119978163, value=10086@qq.com row_1 column=f1:name, timestamp=1478119459805, value=andy row_2 column=f1:email, timestamp=1478120078440, value=10086@qq.com row_2 column=f1:name, timestamp=1478120133536, value=maizi 2 row(s) in 0.3150 seconds hbase(main):016:0>scan 'test_table2' ROW COLUMN+CELL row_1 column=f1:age, timestamp=1478119757136, value=25 row_1 column=f1:name, timestamp=1478119459805, value=andy row_2 column=f1:email, timestamp=1478120078440, value=10086@qq.com row_2 column=f1:name, timestamp=1478120133536, value=maizi 2 row(s) in 0.1080 seconds hbase(main):017:0> 若是删除不存在的列修饰符,看下会是什么情况 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.HBaseConfiguration; 7 import org.apache.hadoop.hbase.TableName; 8 import org.apache.hadoop.hbase.client.Delete; 9 import org.apache.hadoop.hbase.client.Get; 10 import org.apache.hadoop.hbase.client.HTable; 11 import org.apache.hadoop.hbase.client.Put; 12 import org.apache.hadoop.hbase.util.Bytes; 13 14 public class HBaseTest { 15 public static void main(String[] args) throws Exception { 16 HTable table = new HTable(getConfig(),TableName.valueOf("test_table2"));//表名是test_table 17 // Put put = new Put(Bytes.toBytes("row_04"));//行键是row_01 18 // put.add(Bytes.toBytes("f1"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f1,列修饰符是name,值是Andy3 19 // put.add(Bytes.toBytes("f2"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f2,列修饰符是name,值是Andy3 20 // table.put(put); 21 22 // Get get = new Get(Bytes.toBytes("row_04")); 23 // get.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("age"));如现在这样,不指定,默认把所有的全拿出来 24 // org.apache.hadoop.hbase.client.Result rest = table.get(get); 25 // System.out.println(rest.toString()); 26 // table.close(); 27 28 Delete delete = new Delete(Bytes.toBytes("row_1")); 29 delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("email----"));//若是删除不存在的列修饰符,看下会是什么情况 30 table.delete(delete); 31 table.close(); 32 } 33 34 public static Configuration getConfig(){ 35 Configuration configuration = new Configuration(); 36 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 37 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 38 return configuration; 39 } 40 } 2016-12-10 16:10:59,651 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x39ce5ac9 connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 16:10:59,684 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 16:10:59,684 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 16:10:59,684 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 16:10:59,685 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 16:10:59,685 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 16:10:59,685 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 16:10:59,687 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 16:10:59,688 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 16:10:59,688 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 16:10:59,688 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 16:10:59,689 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 16:10:59,689 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 16:10:59,689 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 16:10:59,690 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 16:10:59,690 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 16:10:59,696 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x39ce5ac90x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 16:10:59,928 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopMaster/192.168.80.10:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 16:11:00,063 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopMaster/192.168.80.10:2181, initiating session 2016-12-10 16:11:00,154 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopMaster/192.168.80.10:2181, sessionid = 0x15825dedcf40012, negotiated timeout = 40000 2016-12-10 16:11:02,018 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x15825dedcf40012 2016-12-10 16:11:02,029 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x15825dedcf40012 closed 2016-12-10 16:11:02,029 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down 若是删除不存在的列族,则会出现什么情况? 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.HBaseConfiguration; 7 import org.apache.hadoop.hbase.TableName; 8 import org.apache.hadoop.hbase.client.Delete; 9 import org.apache.hadoop.hbase.client.Get; 10 import org.apache.hadoop.hbase.client.HTable; 11 import org.apache.hadoop.hbase.client.Put; 12 import org.apache.hadoop.hbase.util.Bytes; 13 14 public class HBaseTest { 15 public static void main(String[] args) throws Exception { 16 HTable table = new HTable(getConfig(),TableName.valueOf("test_table2"));//表名是test_table 17 // Put put = new Put(Bytes.toBytes("row_04"));//行键是row_01 18 // put.add(Bytes.toBytes("f1"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f1,列修饰符是name,值是Andy3 19 // put.add(Bytes.toBytes("f2"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f2,列修饰符是name,值是Andy3 20 // table.put(put); 21 22 // Get get = new Get(Bytes.toBytes("row_04")); 23 // get.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("age"));如现在这样,不指定,默认把所有的全拿出来 24 // org.apache.hadoop.hbase.client.Result rest = table.get(get); 25 // System.out.println(rest.toString()); 26 // table.close(); 27 28 Delete delete = new Delete(Bytes.toBytes("row_1")); 29 delete.deleteColumn(Bytes.toBytes("f3"), Bytes.toBytes("email"));//若是删除不存在的列族,则会出现什么情况? 30 table.delete(delete); 31 table.close(); 32 } 33 34 public static Configuration getConfig(){ 35 Configuration configuration = new Configuration(); 36 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 37 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 38 return configuration; 39 } 40 } 2016-12-10 16:13:54,520 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x1646b78d connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 16:13:54,560 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 16:13:54,561 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 16:13:54,561 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 16:13:54,561 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 16:13:54,564 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 16:13:54,566 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 16:13:54,568 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 16:13:54,569 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 16:13:54,569 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 16:13:54,570 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 16:13:54,570 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 16:13:54,570 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 16:13:54,571 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 16:13:54,571 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 16:13:54,572 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 16:13:54,576 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x1646b78d0x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 16:13:54,768 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopMaster/192.168.80.10:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 16:13:54,778 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopMaster/192.168.80.10:2181, initiating session 2016-12-10 16:13:54,855 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopMaster/192.168.80.10:2181, sessionid = 0x15825dedcf40013, negotiated timeout = 40000 Exception in thread "main" org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException: org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException: Column family f3 does not exist in region test_table2,,1478116411036.086c41857c60fbce5f79f61c45269784. in table 'test_table2', {NAME => 'f1', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', COMPRESSION => 'NONE', VERSIONS => '1', TTL => 'FOREVER', MIN_VERSIONS => '0', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}, {NAME => 'f2', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', COMPRESSION => 'NONE', VERSIONS => '1', TTL => 'FOREVER', MIN_VERSIONS => '0', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'} at org.apache.hadoop.hbase.regionserver.HRegion.doBatchMutate(HRegion.java:3562) at org.apache.hadoop.hbase.regionserver.HRegion.delete(HRegion.java:2604) at org.apache.hadoop.hbase.regionserver.RSRpcServices.mutate(RSRpcServices.java:2283) at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:33646) at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2178) at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:112) at org.apache.hadoop.hbase.ipc.RpcExecutor.consumerLoop(RpcExecutor.java:133) at org.apache.hadoop.hbase.ipc.RpcExecutor$1.run(RpcExecutor.java:108) at java.lang.Thread.run(Thread.java:745) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.apache.hadoop.ipc.RemoteException.instantiateException(RemoteException.java:106) at org.apache.hadoop.ipc.RemoteException.unwrapRemoteException(RemoteException.java:95) at org.apache.hadoop.hbase.protobuf.ProtobufUtil.getRemoteException(ProtobufUtil.java:329) at org.apache.hadoop.hbase.client.HTable$4.call(HTable.java:978) at org.apache.hadoop.hbase.client.HTable$4.call(HTable.java:965) at org.apache.hadoop.hbase.client.RpcRetryingCaller.callWithRetries(RpcRetryingCaller.java:136) at org.apache.hadoop.hbase.client.HTable.delete(HTable.java:982) at zhouls.bigdata.HbaseProject.Test1.HBaseTest.main(HBaseTest.java:31) Caused by: org.apache.hadoop.hbase.ipc.RemoteWithExtrasException(org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException): org.apache.hadoop.hbase.regionserver.NoSuchColumnFamilyException: Column family f3 does not exist in region test_table2,,1478116411036.086c41857c60fbce5f79f61c45269784. in table 'test_table2', {NAME => 'f1', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', COMPRESSION => 'NONE', VERSIONS => '1', TTL => 'FOREVER', MIN_VERSIONS => '0', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}, {NAME => 'f2', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', COMPRESSION => 'NONE', VERSIONS => '1', TTL => 'FOREVER', MIN_VERSIONS => '0', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'} at org.apache.hadoop.hbase.regionserver.HRegion.doBatchMutate(HRegion.java:3562) at org.apache.hadoop.hbase.regionserver.HRegion.delete(HRegion.java:2604) at org.apache.hadoop.hbase.regionserver.RSRpcServices.mutate(RSRpcServices.java:2283) at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$2.callBlockingMethod(ClientProtos.java:33646) at org.apache.hadoop.hbase.ipc.RpcServer.call(RpcServer.java:2178) at org.apache.hadoop.hbase.ipc.CallRunner.run(CallRunner.java:112) at org.apache.hadoop.hbase.ipc.RpcExecutor.consumerLoop(RpcExecutor.java:133) at org.apache.hadoop.hbase.ipc.RpcExecutor$1.run(RpcExecutor.java:108) at java.lang.Thread.run(Thread.java:745) at org.apache.hadoop.hbase.ipc.RpcClientImpl.call(RpcClientImpl.java:1267) at org.apache.hadoop.hbase.ipc.AbstractRpcClient.callBlockingMethod(AbstractRpcClient.java:227) at org.apache.hadoop.hbase.ipc.AbstractRpcClient$BlockingRpcChannelImplementation.callBlockingMethod(AbstractRpcClient.java:336) at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$BlockingStub.mutate(ClientProtos.java:34082) at org.apache.hadoop.hbase.client.HTable$4.call(HTable.java:975) ... 4 more 这也是, 证明,为什么HBase在创建表时,列簇是必须要,列可不要? 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.HBaseConfiguration; 7 import org.apache.hadoop.hbase.TableName; 8 import org.apache.hadoop.hbase.client.Delete; 9 import org.apache.hadoop.hbase.client.Get; 10 import org.apache.hadoop.hbase.client.HTable; 11 import org.apache.hadoop.hbase.client.Put; 12 import org.apache.hadoop.hbase.util.Bytes; 13 14 public class HBaseTest { 15 public static void main(String[] args) throws Exception { 16 HTable table = new HTable(getConfig(),TableName.valueOf("test_table2"));//表名是test_table 17 // Put put = new Put(Bytes.toBytes("row_04"));//行键是row_01 18 // put.add(Bytes.toBytes("f1"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f1,列修饰符是name,值是Andy3 19 // put.add(Bytes.toBytes("f2"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f2,列修饰符是name,值是Andy3 20 // table.put(put); 21 22 // Get get = new Get(Bytes.toBytes("row_04")); 23 // get.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("age"));如现在这样,不指定,默认把所有的全拿出来 24 // org.apache.hadoop.hbase.client.Result rest = table.get(get); 25 // System.out.println(rest.toString()); 26 // table.close(); 27 28 Delete delete = new Delete(Bytes.toBytes("row_2")); 29 delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("email")); 30 delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("name")); 31 table.delete(delete); 32 table.close(); 33 } 34 35 public static Configuration getConfig(){ 36 Configuration configuration = new Configuration(); 37 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 38 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 39 return configuration; 40 } 41 } 2016-12-10 16:20:39,421 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x27758c30 connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 16:20:39,445 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 16:20:39,446 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 16:20:39,446 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 16:20:39,446 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 16:20:39,446 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 16:20:39,447 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 16:20:39,448 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 16:20:39,448 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 16:20:39,448 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 16:20:39,449 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 16:20:39,449 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 16:20:39,449 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 16:20:39,449 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 16:20:39,450 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 16:20:39,450 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 16:20:39,452 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x27758c300x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 16:20:39,562 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopSlave1/192.168.80.11:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 16:20:39,567 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopSlave1/192.168.80.11:2181, initiating session 2016-12-10 16:20:39,595 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopSlave1/192.168.80.11:2181, sessionid = 0x2587338ecb40011, negotiated timeout = 40000 2016-12-10 16:20:41,278 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x2587338ecb40011 2016-12-10 16:20:41,283 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x2587338ecb40011 closed 2016-12-10 16:20:41,284 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down hbase(main):017:0>scan 'test_table2' ROW COLUMN+CELL row_1 column=f1:age, timestamp=1478119757136, value=25 row_1 column=f1:name, timestamp=1478119459805, value=andy row_2 column=f1:email, timestamp=1478120078440, value=10086@qq.com row_2 column=f1:name, timestamp=1478120133536, value=maizi 2 row(s) in 0.1520 seconds hbase(main):018:0>scan 'test_table2' ROW COLUMN+CELL row_1 column=f1:age, timestamp=1478119757136, value=25 row_1 column=f1:name, timestamp=1478119459805, value=andy 1 row(s) in 0.1110 seconds hbase(main):019:0> 这就是,若不指定删除的列,则 Delete delete = new Delete(Bytes.toBytes("row_2")); 会删除,全部的列。 这就是,若指定删除的列,则 delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("email")); delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("name")); 只删除,被指定的列 本文转自大数据躺过的坑博客园博客,原文链接:http://www.cnblogs.com/zlslch/p/6155978.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

HBase编程 API入门系列之get(客户端而言)(2)

1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.HBaseConfiguration; 7 import org.apache.hadoop.hbase.TableName; 8 import org.apache.hadoop.hbase.client.Get; 9 import org.apache.hadoop.hbase.client.HTable; 10 import org.apache.hadoop.hbase.client.Put; 11 import org.apache.hadoop.hbase.util.Bytes; 12 13 public class HBaseTest { 14 public static void main(String[] args) throws Exception { 15 HTable table = new HTable(getConfig(),TableName.valueOf("test_table"));//表名是test_table 16 // Put put = new Put(Bytes.toBytes("row_03"));//行键是row_01 17 // put.add(Bytes.toBytes("f"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f,列修饰符是name,值是Andy3 18 // table.put(put); 19 20 Get get = new Get(Bytes.toBytes("row_03")); 21 org.apache.hadoop.hbase.client.Result rest = table.get(get); 22 System.out.println(rest.toString()); 23 table.close(); 24 } 25 26 public static Configuration getConfig(){ 27 Configuration configuration = new Configuration(); 28 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 29 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 30 return configuration; 31 } 32 } 2016-12-10 14:37:25,665 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x62ba5f6a connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 14:37:25,687 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 14:37:25,687 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 14:37:25,687 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 14:37:25,688 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 14:37:25,688 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 14:37:25,688 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 14:37:25,689 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 14:37:25,690 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 14:37:25,690 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 14:37:25,691 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 14:37:25,691 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 14:37:25,691 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 14:37:25,692 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 14:37:25,692 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 14:37:25,693 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 14:37:25,696 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x62ba5f6a0x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 14:37:25,810 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopMaster/192.168.80.10:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 14:37:25,819 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopMaster/192.168.80.10:2181, initiating session 2016-12-10 14:37:25,905 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopMaster/192.168.80.10:2181, sessionid = 0x15825dedcf40002, negotiated timeout = 40000 keyvalues={row_03/f:name/1478104823358/Put/vlen=5/seqid=0} 2016-12-10 14:37:27,208 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x15825dedcf40002 2016-12-10 14:37:27,214 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x15825dedcf40002 closed 2016-12-10 14:37:27,215 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.HBaseConfiguration; 7 import org.apache.hadoop.hbase.TableName; 8 import org.apache.hadoop.hbase.client.Get; 9 import org.apache.hadoop.hbase.client.HTable; 10 import org.apache.hadoop.hbase.client.Put; 11 import org.apache.hadoop.hbase.util.Bytes; 12 13 public class HBaseTest { 14 public static void main(String[] args) throws Exception { 15 HTable table = new HTable(getConfig(),TableName.valueOf("test_table"));//表名是test_table 16 // Put put = new Put(Bytes.toBytes("row_03"));//行键是row_01 17 // put.add(Bytes.toBytes("f"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f,列修饰符是name,值是Andy3 18 // table.put(put); 19 20 Get get = new Get(Bytes.toBytes("row_01")); 21 org.apache.hadoop.hbase.client.Result rest = table.get(get); 22 System.out.println(rest.toString()); 23 table.close(); 24 } 25 26 public static Configuration getConfig(){ 27 Configuration configuration = new Configuration(); 28 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 29 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 30 return configuration; 31 } 32 } 2016-12-10 14:40:43,222 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x114b320d connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 14:40:43,256 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 14:40:43,256 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 14:40:43,256 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 14:40:43,256 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 14:40:43,257 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 14:40:43,257 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 14:40:43,258 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 14:40:43,259 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 14:40:43,259 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 14:40:43,259 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 14:40:43,260 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 14:40:43,260 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 14:40:43,260 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 14:40:43,260 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 14:40:43,261 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 14:40:43,266 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x114b320d0x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 14:40:43,392 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopSlave1/192.168.80.11:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 14:40:43,402 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopSlave1/192.168.80.11:2181, initiating session 2016-12-10 14:40:43,432 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopSlave1/192.168.80.11:2181, sessionid = 0x2587338ecb40004, negotiated timeout = 40000 keyvalues={row_01/f:col/1478102698687/Put/vlen=5/seqid=0, row_01/f:name/1478104345828/Put/vlen=4/seqid=0} 2016-12-10 14:40:45,146 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x2587338ecb40004 2016-12-10 14:40:45,153 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x2587338ecb40004 closed 2016-12-10 14:40:45,153 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.HBaseConfiguration; 7 import org.apache.hadoop.hbase.TableName; 8 import org.apache.hadoop.hbase.client.Get; 9 import org.apache.hadoop.hbase.client.HTable; 10 import org.apache.hadoop.hbase.client.Put; 11 import org.apache.hadoop.hbase.util.Bytes; 12 13 public class HBaseTest { 14 public static void main(String[] args) throws Exception { 15 HTable table = new HTable(getConfig(),TableName.valueOf("test_table"));//表名是test_table 16 // Put put = new Put(Bytes.toBytes("row_03"));//行键是row_01 17 // put.add(Bytes.toBytes("f"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f,列修饰符是name,值是Andy3 18 // table.put(put); 19 20 Get get = new Get(Bytes.toBytes("row_01")); 21 get.addColumn(Bytes.toBytes("f"), Bytes.toBytes("name")); 22 org.apache.hadoop.hbase.client.Result rest = table.get(get); 23 System.out.println(rest.toString()); 24 table.close(); 25 } 26 27 public static Configuration getConfig(){ 28 Configuration configuration = new Configuration(); 29 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 30 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 31 return configuration; 32 } 33 } 2016-12-10 14:43:35,385 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x62ba5f6a connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 14:43:35,408 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 14:43:35,409 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 14:43:35,409 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 14:43:35,409 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 14:43:35,409 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 14:43:35,410 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 14:43:35,411 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 14:43:35,412 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 14:43:35,412 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 14:43:35,413 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 14:43:35,413 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 14:43:35,413 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 14:43:35,413 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 14:43:35,414 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 14:43:35,414 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 14:43:35,416 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x62ba5f6a0x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 14:43:35,518 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopMaster/192.168.80.10:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 14:43:35,525 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopMaster/192.168.80.10:2181, initiating session 2016-12-10 14:43:35,590 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopMaster/192.168.80.10:2181, sessionid = 0x15825dedcf40003, negotiated timeout = 40000 keyvalues={row_01/f:name/1478104345828/Put/vlen=4/seqid=0} 2016-12-10 14:43:37,380 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x15825dedcf40003 2016-12-10 14:43:37,386 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x15825dedcf40003 closed 2016-12-10 14:43:37,386 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.HBaseConfiguration; 7 import org.apache.hadoop.hbase.TableName; 8 import org.apache.hadoop.hbase.client.Get; 9 import org.apache.hadoop.hbase.client.HTable; 10 import org.apache.hadoop.hbase.client.Put; 11 import org.apache.hadoop.hbase.util.Bytes; 12 13 public class HBaseTest { 14 public static void main(String[] args) throws Exception { 15 HTable table = new HTable(getConfig(),TableName.valueOf("test_table"));//表名是test_table 16 // Put put = new Put(Bytes.toBytes("row_03"));//行键是row_01 17 // put.add(Bytes.toBytes("f"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f,列修饰符是name,值是Andy3 18 // table.put(put); 19 20 Get get = new Get(Bytes.toBytes("row_01")); 21 get.addColumn(Bytes.toBytes("f"), Bytes.toBytes("col")); 22 org.apache.hadoop.hbase.client.Result rest = table.get(get); 23 System.out.println(rest.toString()); 24 table.close(); 25 } 26 27 public static Configuration getConfig(){ 28 Configuration configuration = new Configuration(); 29 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 30 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 31 return configuration; 32 } 33 } 2016-12-10 14:45:42,225 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x39ce5ac9 connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 14:45:42,264 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 14:45:42,265 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 14:45:42,266 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 14:45:42,266 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 14:45:42,267 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 14:45:42,267 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 14:45:42,269 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 14:45:42,276 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 14:45:42,276 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 14:45:42,276 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 14:45:42,277 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 14:45:42,277 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 14:45:42,277 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 14:45:42,277 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 14:45:42,278 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 14:45:42,281 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x39ce5ac90x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 14:45:42,444 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopSlave1/192.168.80.11:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 14:45:42,451 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopSlave1/192.168.80.11:2181, initiating session 2016-12-10 14:45:42,478 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopSlave1/192.168.80.11:2181, sessionid = 0x2587338ecb40005, negotiated timeout = 40000 keyvalues={row_01/f:col/1478102698687/Put/vlen=5/seqid=0} 2016-12-10 14:45:43,893 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x2587338ecb40005 2016-12-10 14:45:43,900 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x2587338ecb40005 closed 2016-12-10 14:45:43,900 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down 在get里,有很多方法,大家自行去研究。大同小异。 这里,为了更好的带领大家研究get,我再新建一个表。 create 'test_table2','f1','f2' 这是HBase里新建表的语句,test_table2是表名,f1和f2是列簇、 hbase(main):001:0>create 'test_table2','f1','f2' 0 row(s) in 15.5960 seconds => Hbase::Table - test_table2 hbase(main):002:0>desc 'test_table2' Table test_table2 is ENABLED test_table2 COLUMN FAMILIES DESCRIPTION {NAME => 'f1', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'} {NAME => 'f2', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'FALSE', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'} 2 row(s) in 1.7530 seconds hbase(main):003:0> 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.HBaseConfiguration; 7 import org.apache.hadoop.hbase.TableName; 8 import org.apache.hadoop.hbase.client.Get; 9 import org.apache.hadoop.hbase.client.HTable; 10 import org.apache.hadoop.hbase.client.Put; 11 import org.apache.hadoop.hbase.util.Bytes; 12 13 public class HBaseTest { 14 public static void main(String[] args) throws Exception { 15 HTable table = new HTable(getConfig(),TableName.valueOf("test_table2"));//表名是test_table 16 Put put = new Put(Bytes.toBytes("row_04"));//行键是row_01 17 put.add(Bytes.toBytes("f1"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f1,列修饰符是name,值是Andy3 18 put.add(Bytes.toBytes("f2"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f2,列修饰符是name,值是Andy3 19 table.put(put); 20 // 21 // Get get = new Get(Bytes.toBytes("row_01")); 22 // get.addColumn(Bytes.toBytes("f"), Bytes.toBytes("col")); 23 // org.apache.hadoop.hbase.client.Result rest = table.get(get); 24 // System.out.println(rest.toString()); 25 table.close(); 26 } 27 28 public static Configuration getConfig(){ 29 Configuration configuration = new Configuration(); 30 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 31 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 32 return configuration; 33 } 34 } hbase(main):001:0>scan 'test_table2' ROW COLUMN+CELL row_04 column=f1:name, timestamp=1478117286377, value=Andy3 row_04 column=f2:name, timestamp=1478117286377, value=Andy3 1 row(s) in 1.5670 seconds hbase(main):002:0> 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.HBaseConfiguration; 7 import org.apache.hadoop.hbase.TableName; 8 import org.apache.hadoop.hbase.client.Get; 9 import org.apache.hadoop.hbase.client.HTable; 10 import org.apache.hadoop.hbase.client.Put; 11 import org.apache.hadoop.hbase.util.Bytes; 12 13 public class HBaseTest { 14 public static void main(String[] args) throws Exception { 15 HTable table = new HTable(getConfig(),TableName.valueOf("test_table2"));//表名是test_table 16 // Put put = new Put(Bytes.toBytes("row_04"));//行键是row_01 17 // put.add(Bytes.toBytes("f1"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f1,列修饰符是name,值是Andy3 18 // put.add(Bytes.toBytes("f2"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f2,列修饰符是name,值是Andy3 19 // table.put(put); 20 21 Get get = new Get(Bytes.toBytes("row_04")); 22 get.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("age"));//比如去拿一个不存在的列修饰符,看会得到什么? 23 org.apache.hadoop.hbase.client.Result rest = table.get(get); 24 System.out.println(rest.toString()); 25 table.close(); 26 } 27 28 public static Configuration getConfig(){ 29 Configuration configuration = new Configuration(); 30 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 31 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 32 return configuration; 33 } 34 } 2016-12-10 15:13:01,074 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x39ce5ac9 connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 15:13:01,104 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 15:13:01,105 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 15:13:01,105 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 15:13:01,105 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 15:13:01,106 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 15:13:01,106 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 15:13:01,109 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 15:13:01,110 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 15:13:01,111 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 15:13:01,111 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 15:13:01,112 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 15:13:01,112 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 15:13:01,113 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 15:13:01,113 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 15:13:01,114 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 15:13:01,118 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x39ce5ac90x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 15:13:01,249 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopMaster/192.168.80.10:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 15:13:01,255 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopMaster/192.168.80.10:2181, initiating session 2016-12-10 15:13:01,326 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopMaster/192.168.80.10:2181, sessionid = 0x15825dedcf4000d, negotiated timeout = 40000 keyvalues=NONE 2016-12-10 15:13:03,155 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x15825dedcf4000d 2016-12-10 15:13:03,163 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x15825dedcf4000d closed 2016-12-10 15:13:03,163 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down 如现在这样,不指定,默认把所有的列全拿出来 (开发实际中,一定要加指定呀) 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.HBaseConfiguration; 7 import org.apache.hadoop.hbase.TableName; 8 import org.apache.hadoop.hbase.client.Get; 9 import org.apache.hadoop.hbase.client.HTable; 10 import org.apache.hadoop.hbase.client.Put; 11 import org.apache.hadoop.hbase.util.Bytes; 12 13 public class HBaseTest { 14 public static void main(String[] args) throws Exception { 15 HTable table = new HTable(getConfig(),TableName.valueOf("test_table2"));//表名是test_table 16 // Put put = new Put(Bytes.toBytes("row_04"));//行键是row_01 17 // put.add(Bytes.toBytes("f1"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f1,列修饰符是name,值是Andy3 18 // put.add(Bytes.toBytes("f2"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f2,列修饰符是name,值是Andy3 19 // table.put(put); 20 21 Get get = new Get(Bytes.toBytes("row_04")); 22 // get.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("age"));如现在这样,不指定,默认把所有的全拿出来 23 org.apache.hadoop.hbase.client.Result rest = table.get(get); 24 System.out.println(rest.toString()); 25 table.close(); 26 } 27 28 public static Configuration getConfig(){ 29 Configuration configuration = new Configuration(); 30 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 31 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 32 return configuration; 33 } 34 } 2016-12-10 15:17:07,672 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x7a45682c connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 15:17:07,694 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 15:17:07,695 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 15:17:07,695 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 15:17:07,696 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 15:17:07,696 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 15:17:07,696 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 15:17:07,698 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 15:17:07,698 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 15:17:07,698 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 15:17:07,698 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 15:17:07,699 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 15:17:07,699 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 15:17:07,699 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 15:17:07,699 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 15:17:07,700 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 15:17:07,702 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x7a45682c0x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 15:17:07,819 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopMaster/192.168.80.10:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 15:17:07,823 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopMaster/192.168.80.10:2181, initiating session 2016-12-10 15:17:07,870 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopMaster/192.168.80.10:2181, sessionid = 0x15825dedcf4000e, negotiated timeout = 40000 keyvalues={row_04/f1:name/1478117286377/Put/vlen=5/seqid=0, row_04/f2:name/1478117286377/Put/vlen=5/seqid=0} 2016-12-10 15:17:09,275 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x15825dedcf4000e 2016-12-10 15:17:09,283 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x15825dedcf4000e closed 2016-12-10 15:17:09,283 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down 本文转自大数据躺过的坑博客园博客,原文链接:http://www.cnblogs.com/zlslch/p/6155713.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

HBase编程 API入门系列之put(客户端而言)(1)

[hadoop@HadoopSlave1 conf]$ cat regionservers HadoopMaster HadoopSlave1 HadoopSlave2 <configuration> <property> <name>hbase.zookeeper.quorum</name> <value>HadoopMaster,HadoopSlave1,HadoopSlave2</value> </property> <property> <name>hbase.rootdir</name> <value>hdfs://HadoopMaster:9000/hbase</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <name>hbase.tmp.dir</name> <value>/home/hadoop/data/hbase-1.2.3/tmp</value> </property> <property> <name>zookeeper.znode.parent</name> <value>/hbase</value> </property> </configuration> export JAVA_HOME=/home/hadoop/app/jdk1.7.0_79 export HBASE_MANAGES_ZK=false (外装的Zookeeper集群) hbase(main):002:0> create 'test_table','f' 语法: create table name , column family test_table 是HBase的数据表名,f是列簇 为了后续的编程,我这里直接先手动创建最简单的hbase数据表。在代码里可以修改。 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import org.apache.hadoop.conf.Configuration; 4 import org.apache.hadoop.hbase.HBaseConfiguration; 5 import org.apache.hadoop.hbase.TableName; 6 import org.apache.hadoop.hbase.client.HTable; 7 import org.apache.hadoop.hbase.client.Put; 8 import org.apache.hadoop.hbase.util.Bytes; 9 10 11 public class HBaseTest { 12 public static void main(String[] args) throws Exception { 13 HTable table = new HTable(getConfig(),TableName.valueOf("test_table"));//表名是test_table 14 Put put = new Put(Bytes.toBytes("row_01"));//行键是row_01 15 put.add(Bytes.toBytes("f"),Bytes.toBytes("col"),Bytes.toBytes("maizi"));//列簇是f,列修饰符是col,值是maizi 16 table.put(put); 17 table.close(); 18 } 19 20 public static Configuration getConfig(){ 21 Configuration configuration = new Configuration(); 22 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 23 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 24 return configuration; 25 } 26 } 2016-12-10 11:05:45,077 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x5fc2fc59 connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 11:05:45,115 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 11:05:45,115 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 11:05:45,115 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 11:05:45,115 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 11:05:45,116 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 11:05:45,116 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 11:05:45,118 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 11:05:45,119 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 11:05:45,120 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 11:05:45,120 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 11:05:45,121 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 11:05:45,121 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 11:05:45,131 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 11:05:45,131 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 11:05:45,132 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 11:05:45,136 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x5fc2fc590x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 11:05:45,329 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopMaster/192.168.80.10:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 11:05:45,365 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopMaster/192.168.80.10:2181, initiating session 2016-12-10 11:05:45,421 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopMaster/192.168.80.10:2181, sessionid = 0x1582587a9550008, negotiated timeout = 40000 2016-12-10 11:05:47,266 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x1582587a9550008 2016-12-10 11:05:47,275 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x1582587a9550008 closed 2016-12-10 11:05:47,275 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down scan 'test_table' 全盘扫描该Hbase数据表test_table 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import org.apache.hadoop.conf.Configuration; 4 import org.apache.hadoop.hbase.HBaseConfiguration; 5 import org.apache.hadoop.hbase.TableName; 6 import org.apache.hadoop.hbase.client.HTable; 7 import org.apache.hadoop.hbase.client.Put; 8 import org.apache.hadoop.hbase.util.Bytes; 9 10 11 public class HBaseTest { 12 public static void main(String[] args) throws Exception { 13 HTable table = new HTable(getConfig(),TableName.valueOf("test_table"));//表名是test_table 14 Put put = new Put(Bytes.toBytes("row_01"));//行键是row_01 15 put.add(Bytes.toBytes("f"),Bytes.toBytes("name"),Bytes.toBytes("Andy"));//列簇是f,列修饰符是col,值是maizi 16 table.put(put); 17 table.close(); 18 } 19 20 public static Configuration getConfig(){ 21 Configuration configuration = new Configuration(); 22 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 23 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 24 return configuration; 25 } 26 } scan 'test_table' 全盘扫描该Hbase数据表test_table 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import org.apache.hadoop.conf.Configuration; 4 import org.apache.hadoop.hbase.HBaseConfiguration; 5 import org.apache.hadoop.hbase.TableName; 6 import org.apache.hadoop.hbase.client.HTable; 7 import org.apache.hadoop.hbase.client.Put; 8 import org.apache.hadoop.hbase.util.Bytes; 9 10 11 public class HBaseTest { 12 public static void main(String[] args) throws Exception { 13 HTable table = new HTable(getConfig(),TableName.valueOf("test_table"));//表名是test_table 14 Put put = new Put(Bytes.toBytes("row_02"));//行键是row_01 15 put.add(Bytes.toBytes("f"),Bytes.toBytes("name"),Bytes.toBytes("Andy2"));//列簇是f,列修饰符是col,值是maizi 16 table.put(put); 17 table.close(); 18 } 19 20 public static Configuration getConfig(){ 21 Configuration configuration = new Configuration(); 22 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 23 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 24 return configuration; 25 } 26 } scan 'test_table' 全盘扫描该Hbase数据表test_table 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import org.apache.hadoop.conf.Configuration; 4 import org.apache.hadoop.hbase.HBaseConfiguration; 5 import org.apache.hadoop.hbase.TableName; 6 import org.apache.hadoop.hbase.client.HTable; 7 import org.apache.hadoop.hbase.client.Put; 8 import org.apache.hadoop.hbase.util.Bytes; 9 10 11 public class HBaseTest { 12 public static void main(String[] args) throws Exception { 13 HTable table = new HTable(getConfig(),TableName.valueOf("test_table"));//表名是test_table 14 Put put = new Put(Bytes.toBytes("row_03"));//行键是row_01 15 put.add(Bytes.toBytes("f"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f,列修饰符是col,值是maizi 16 table.put(put); 17 table.close(); 18 } 19 20 public static Configuration getConfig(){ 21 Configuration configuration = new Configuration(); 22 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 23 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 24 return configuration; 25 } 26 } scan 'test_table' 全盘扫描该Hbase数据表test_table 本文转自大数据躺过的坑博客园博客,原文链接:http://www.cnblogs.com/zlslch/p/6155220.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

Android GIS开发系列-- 入门季(3) GraphicsLayer添加点、线、面

GraphicsLayer是图形图层,可以自定义图形添加到地图上。调用GraphicsLayer的addGraphic方法就能添加图形,此方法要一个Graphic对象,此对象的构造方法是Graphic(Geometrygeometry,Symbolsymbol),前面第一个是要素,而Geometry的子类有Envelope,MultiPath,MultiPoint,Point,Segment,Line,Polygon,Polyline。我们所常用的有点Point,线Polyline,面Polygon。而后面一 个参数是样式,点的样式是SimpleMarkerSymbol,线的样式是SimpleLineSymbol,面的样式是SimpleFillSymbol。 一、GraphicsLayer添加点: Graphicgraphic=newGraphic(point,newSimpleMarkerSymbol(Color.RED,5,SimpleMarkerSymbol.STYLE.CIRCLE)); graphicsLayer.addGraphic(graphic); 二、添加线,样式有实线、虚线、点虚线、点点虚线、点线等。效果图如下: Polylinepolyline=newPolyline(); polyline.startPath(newPoint(113,23));//第一个点用startPath,后面的点用lineTo方法 polyline.lineTo(newPoint(123,23)); graphic=newGraphic(polyline,newSimpleLineSymbol(Color.RED,3,SimpleLineSymbol.STYLE.SOLID)); graphicsLayer.addGraphic(graphic); 三、添加面Polygon,效果图如下: Polygonpolygon=newPolygon(); //第一个点startPath,后面的点用lineTo polygon.startPath(newPoint(118,23)); polygon.lineTo(newPoint(118,15)); polygon.lineTo(newPoint(113,13)); graphic=newGraphic(polygon,newSimpleFillSymbol(Color.GREEN,SimpleFillSymbol.STYLE.SOLID)); graphicsLayer.addGraphic(graphic); Code for all: packagecom.arcgis.test; importandroid.graphics.Color; importandroid.os.Bundle; importandroid.support.annotation.Nullable; importandroid.support.v7.app.AppCompatActivity; importandroid.view.View; importandroid.widget.AdapterView; importandroid.widget.Button; importandroid.widget.Spinner; importcom.esri.android.map.GraphicsLayer; importcom.esri.android.map.MapView; importcom.esri.android.map.ags.ArcGISTiledMapServiceLayer; importcom.esri.android.map.event.OnSingleTapListener; importcom.esri.core.geometry.Point; importcom.esri.core.geometry.Polygon; importcom.esri.core.geometry.Polyline; importcom.esri.core.map.Graphic; importcom.esri.core.symbol.SimpleFillSymbol; importcom.esri.core.symbol.SimpleLineSymbol; importcom.esri.core.symbol.SimpleMarkerSymbol; importjava.util.ArrayList; importjava.util.List; publicclassGraphicActivityextendsAppCompatActivity{ privateMapViewmMapView; privateSpinnergraphicTypeSpinner; privateButtonclernBtn; privateArcGISTiledMapServiceLayerarcGISTiledMapServiceLayer; privateGraphicsLayergraphicsLayer; privateStringmapServerUrl="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"; //点集合 privateList<Point>pointList=newArrayList<>(); privateGraphicgraphic; @Override protectedvoidonCreate(@NullableBundlesavedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_graphic); initView(); addLayer(); } privatevoidinitView(){ mMapView=(MapView)findViewById(R.id.map_view); //mapview点击事件 mMapView.setOnSingleTapListener(newOnSingleTapListener(){ @Override publicvoidonSingleTap(floatx,floaty){ handleSingleTap(x,y); } }); graphicTypeSpinner=(Spinner)findViewById(R.id.spinner_type); graphicTypeSpinner.setOnItemSelectedListener(newAdapterView.OnItemSelectedListener(){ @Override publicvoidonItemSelected(AdapterView<?>parent,Viewview,intposition,longid){ pointList.removeAll(pointList); graphicsLayer.removeAll(); } @Override publicvoidonNothingSelected(AdapterView<?>parent){ } }); clernBtn=(Button)findViewById(R.id.clear_graphic); clernBtn.setOnClickListener(newView.OnClickListener(){ @Override publicvoidonClick(Viewv){ pointList.removeAll(pointList); graphicsLayer.removeAll(); } }); } privatevoidaddLayer(){ arcGISTiledMapServiceLayer=newArcGISTiledMapServiceLayer(mapServerUrl); mMapView.addLayer(arcGISTiledMapServiceLayer); graphicsLayer=newGraphicsLayer(); mMapView.addLayer(graphicsLayer); } privatevoidhandleSingleTap(floatx,floaty){ Pointpoint=mMapView.toMapPoint(x,y); graphicsLayer.removeAll(); pointList.add(point); Stringtype=graphicTypeSpinner.getSelectedItem().toString().trim(); switch(type){ case"点": graphic=newGraphic(point,newSimpleMarkerSymbol(Color.RED,5,SimpleMarkerSymbol.STYLE.CIRCLE)); graphicsLayer.addGraphic(graphic); break; case"线": Polylinepolyline=newPolyline(); if(pointList.size()>1){ for(inti=0;i<pointList.size();i++){ if(i==0){ polyline.startPath(pointList.get(i)); }else{ polyline.lineTo(pointList.get(i)); } } } graphic=newGraphic(polyline,newSimpleLineSymbol(Color.RED,3,SimpleLineSymbol.STYLE.SOLID)); graphicsLayer.addGraphic(graphic); break; case"面": Polygonpolygon=newPolygon(); for(inti=0;i<pointList.size();i++){ if(i==0){ polygon.startPath(pointList.get(i)); }else{ polygon.lineTo(pointList.get(i)); } } graphic=newGraphic(polygon,newSimpleFillSymbol(Color.GREEN,SimpleFillSymbol.STYLE.SOLID)); graphicsLayer.addGraphic(graphic); break; } } } 没有整理与归纳的知识,一文不值!高度概括与梳理的知识,才是自己真正的知识与技能。 永远不要让自己的自由、好奇、充满创造力的想法被现实的框架所束缚,让创造力自由成长吧! 多花时间,关心他(她)人,正如别人所关心你的。理想的腾飞与实现,没有别人的支持与帮助,是万万不能的。 本文转自wenglabs博客园博客,原文链接:http://www.cnblogs.com/arxive/p/7751859.html ,如需转载请自行联系原作者

优秀的个人博客,低调大师

HBase编程 API入门系列之scan(客户端而言)(5)

心得,写在前面的话,也许,中间会要多次执行,连接超时,多试试就好了。 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.HBaseConfiguration; 7 import org.apache.hadoop.hbase.TableName; 8 import org.apache.hadoop.hbase.client.Delete; 9 import org.apache.hadoop.hbase.client.Get; 10 import org.apache.hadoop.hbase.client.HTable; 11 import org.apache.hadoop.hbase.client.Put; 12 import org.apache.hadoop.hbase.client.ResultScanner; 13 import org.apache.hadoop.hbase.client.Scan; 14 import org.apache.hadoop.hbase.util.Bytes; 15 16 public class HBaseTest { 17 public static void main(String[] args) throws Exception { 18 HTable table = new HTable(getConfig(),TableName.valueOf("test_table"));//表名是test_table 19 // Put put = new Put(Bytes.toBytes("row_04"));//行键是row_04 20 // put.add(Bytes.toBytes("f"),Bytes.toBytes("name"),Bytes.toBytes("Andy1"));//列簇是f,列修饰符是name,值是Andy0 21 // put.add(Bytes.toBytes("f2"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f2,列修饰符是name,值是Andy3 22 // table.put(put); 23 // table.close(); 24 25 // Get get = new Get(Bytes.toBytes("row_04")); 26 // get.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("age"));如现在这样,不指定,默认把所有的全拿出来 27 // org.apache.hadoop.hbase.client.Result rest = table.get(get); 28 // System.out.println(rest.toString()); 29 // table.close(); 30 31 // Delete delete = new Delete(Bytes.toBytes("row_2")); 32 // delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("email")); 33 // delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("name")); 34 // table.delete(delete); 35 // table.close(); 36 37 // Delete delete = new Delete(Bytes.toBytes("row_04")); 38 //// delete.deleteColumn(Bytes.toBytes("f"), Bytes.toBytes("name"));//deleteColumn是删除某一个列簇里的最新时间戳版本。 39 // delete.deleteColumns(Bytes.toBytes("f"), Bytes.toBytes("name"));//delete.deleteColumns是删除某个列簇里的所有时间戳版本。 40 // table.delete(delete); 41 // table.close(); 42 43 44 Scan scan = new Scan(); 45 ResultScanner rst = table.getScanner(scan); 46 System.out.println(rst.toString()); 47 table.close(); 48 } 49 50 public static Configuration getConfig(){ 51 Configuration configuration = new Configuration(); 52 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 53 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 54 return configuration; 55 } 56 } 2016-12-10 17:24:08,394 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x7a45682c connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 17:24:08,432 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 17:24:08,433 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 17:24:08,434 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 17:24:08,435 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 17:24:08,436 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 17:24:08,436 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 17:24:08,439 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 17:24:08,442 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 17:24:08,443 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 17:24:08,443 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 17:24:08,443 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 17:24:08,444 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 17:24:08,444 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 17:24:08,445 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 17:24:08,445 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 17:24:08,449 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x7a45682c0x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 17:24:08,638 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopMaster/192.168.80.10:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 17:24:08,651 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopMaster/192.168.80.10:2181, initiating session 2016-12-10 17:24:08,688 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopMaster/192.168.80.10:2181, sessionid = 0x15825dedcf4002b, negotiated timeout = 40000 org.apache.hadoop.hbase.client.ClientScanner@23b804dd 2016-12-10 17:24:10,158 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x15825dedcf4002b 2016-12-10 17:24:10,166 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x15825dedcf4002b closed 2016-12-10 17:24:10,167 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.HBaseConfiguration; 7 import org.apache.hadoop.hbase.TableName; 8 import org.apache.hadoop.hbase.client.Delete; 9 import org.apache.hadoop.hbase.client.Get; 10 import org.apache.hadoop.hbase.client.HTable; 11 import org.apache.hadoop.hbase.client.Put; 12 import org.apache.hadoop.hbase.client.ResultScanner; 13 import org.apache.hadoop.hbase.client.Scan; 14 import org.apache.hadoop.hbase.util.Bytes; 15 16 public class HBaseTest { 17 public static void main(String[] args) throws Exception { 18 HTable table = new HTable(getConfig(),TableName.valueOf("test_table"));//表名是test_table 19 // Put put = new Put(Bytes.toBytes("row_04"));//行键是row_04 20 // put.add(Bytes.toBytes("f"),Bytes.toBytes("name"),Bytes.toBytes("Andy1"));//列簇是f,列修饰符是name,值是Andy0 21 // put.add(Bytes.toBytes("f2"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f2,列修饰符是name,值是Andy3 22 // table.put(put); 23 // table.close(); 24 25 // Get get = new Get(Bytes.toBytes("row_04")); 26 // get.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("age"));如现在这样,不指定,默认把所有的全拿出来 27 // org.apache.hadoop.hbase.client.Result rest = table.get(get); 28 // System.out.println(rest.toString()); 29 // table.close(); 30 31 // Delete delete = new Delete(Bytes.toBytes("row_2")); 32 // delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("email")); 33 // delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("name")); 34 // table.delete(delete); 35 // table.close(); 36 37 // Delete delete = new Delete(Bytes.toBytes("row_04")); 38 //// delete.deleteColumn(Bytes.toBytes("f"), Bytes.toBytes("name"));//deleteColumn是删除某一个列簇里的最新时间戳版本。 39 // delete.deleteColumns(Bytes.toBytes("f"), Bytes.toBytes("name"));//delete.deleteColumns是删除某个列簇里的所有时间戳版本。 40 // table.delete(delete); 41 // table.close(); 42 43 44 Scan scan = new Scan(); 45 ResultScanner rst = table.getScanner(scan); 46 System.out.println(rst.toString()); 47 for (org.apache.hadoop.hbase.client.Result next = rst.next();next !=null;next = rst.next() ){ 48 System.out.println(next.toString()); 49 } 50 table.close(); 51 52 } 53 54 public static Configuration getConfig(){ 55 Configuration configuration = new Configuration(); 56 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 57 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 58 return configuration; 59 } 60 } 2016-12-10 17:29:53,501 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x7a45682c connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 17:29:53,520 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 17:29:53,520 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 17:29:53,520 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 17:29:53,520 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 17:29:53,520 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 17:29:53,521 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 17:29:53,522 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 17:29:53,522 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 17:29:53,522 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 17:29:53,522 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 17:29:53,522 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 17:29:53,523 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 17:29:53,523 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 17:29:53,523 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 17:29:53,523 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 17:29:53,525 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x7a45682c0x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 17:29:53,588 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopSlave1/192.168.80.11:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 17:29:53,594 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopSlave1/192.168.80.11:2181, initiating session 2016-12-10 17:29:53,612 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopSlave1/192.168.80.11:2181, sessionid = 0x2587338ecb40026, negotiated timeout = 40000 org.apache.hadoop.hbase.client.ClientScanner@ff35374 keyvalues={row_01/f:col/1478102698687/Put/vlen=5/seqid=0, row_01/f:name/1478104345828/Put/vlen=4/seqid=0} keyvalues={row_02/f:name/1478104477628/Put/vlen=5/seqid=0} keyvalues={row_03/f:name/1478123664884/Put/vlen=5/seqid=0} 2016-12-10 17:29:54,863 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x2587338ecb40026 2016-12-10 17:29:54,868 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x2587338ecb40026 closed 2016-12-10 17:29:54,868 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.HBaseConfiguration; 7 import org.apache.hadoop.hbase.TableName; 8 import org.apache.hadoop.hbase.client.Delete; 9 import org.apache.hadoop.hbase.client.Get; 10 import org.apache.hadoop.hbase.client.HTable; 11 import org.apache.hadoop.hbase.client.Put; 12 import org.apache.hadoop.hbase.client.ResultScanner; 13 import org.apache.hadoop.hbase.client.Scan; 14 import org.apache.hadoop.hbase.util.Bytes; 15 16 public class HBaseTest { 17 public static void main(String[] args) throws Exception { 18 HTable table = new HTable(getConfig(),TableName.valueOf("test_table2"));//表名是test_table2 19 // Put put = new Put(Bytes.toBytes("row_04"));//行键是row_04 20 // put.add(Bytes.toBytes("f"),Bytes.toBytes("name"),Bytes.toBytes("Andy1"));//列簇是f,列修饰符是name,值是Andy0 21 // put.add(Bytes.toBytes("f2"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f2,列修饰符是name,值是Andy3 22 // table.put(put); 23 // table.close(); 24 25 // Get get = new Get(Bytes.toBytes("row_04")); 26 // get.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("age"));如现在这样,不指定,默认把所有的全拿出来 27 // org.apache.hadoop.hbase.client.Result rest = table.get(get); 28 // System.out.println(rest.toString()); 29 // table.close(); 30 31 // Delete delete = new Delete(Bytes.toBytes("row_2")); 32 // delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("email")); 33 // delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("name")); 34 // table.delete(delete); 35 // table.close(); 36 37 // Delete delete = new Delete(Bytes.toBytes("row_04")); 38 //// delete.deleteColumn(Bytes.toBytes("f"), Bytes.toBytes("name"));//deleteColumn是删除某一个列簇里的最新时间戳版本。 39 // delete.deleteColumns(Bytes.toBytes("f"), Bytes.toBytes("name"));//delete.deleteColumns是删除某个列簇里的所有时间戳版本。 40 // table.delete(delete); 41 // table.close(); 42 43 44 Scan scan = new Scan(); 45 ResultScanner rst = table.getScanner(scan); 46 System.out.println(rst.toString()); 47 for (org.apache.hadoop.hbase.client.Result next = rst.next();next !=null;next = rst.next() ){ 48 System.out.println(next.toString()); 49 } 50 table.close(); 51 } 52 53 public static Configuration getConfig(){ 54 Configuration configuration = new Configuration(); 55 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 56 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 57 return configuration; 58 } 59 } 2016-12-10 17:32:25,591 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x39ce5ac9 connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 17:32:25,612 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 17:32:25,613 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 17:32:25,613 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 17:32:25,613 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 17:32:25,613 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 17:32:25,613 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 17:32:25,615 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 17:32:25,615 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 17:32:25,615 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 17:32:25,616 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 17:32:25,616 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 17:32:25,616 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 17:32:25,616 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 17:32:25,616 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 17:32:25,617 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 17:32:25,619 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x39ce5ac90x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 17:32:25,701 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopMaster/192.168.80.10:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 17:32:25,705 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopMaster/192.168.80.10:2181, initiating session 2016-12-10 17:32:25,762 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopMaster/192.168.80.10:2181, sessionid = 0x15825dedcf4002e, negotiated timeout = 40000 org.apache.hadoop.hbase.client.ClientScanner@529d8124 keyvalues={row_1/f1:age/1478119757136/Put/vlen=2/seqid=0, row_1/f1:name/1478119459805/Put/vlen=4/seqid=0} 2016-12-10 17:32:27,091 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x15825dedcf4002e 2016-12-10 17:32:27,099 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x15825dedcf4002e closed 2016-12-10 17:32:27,100 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down 1 Scan scan = new Scan(); 2 scan.setStartRow(Bytes.toBytes("3")); 3 ResultScanner rst = table.getScanner(scan); 4 System.out.println(rst.toString()); 5 for (org.apache.hadoop.hbase.client.Result next = rst.next();next !=null;next = rst.next() ){ 6 System.out.println(next.toString()); 7 } 8 table.close(); 1 Scan scan = new Scan(); 2 scan.setStartRow(Bytes.toBytes("3"));//包含开始行键 3 scan.setStopRow(Bytes.toBytes("5"));//不包含结束行键 4 ResultScanner rst = table.getScanner(scan); 5 System.out.println(rst.toString()); 6 for (org.apache.hadoop.hbase.client.Result next = rst.next();next !=null;next = rst.next() ){ 7 System.out.println(next.toString()); 8 } 9 table.close(); 1 Scan scan = new Scan(); 2 scan.setStartRow(Bytes.toBytes("1"));//包含开始行键 3 scan.setStopRow(Bytes.toBytes("5"));//不包含结束行键 4 ResultScanner rst = table.getScanner(scan); 5 System.out.println(rst.toString()); 6 for (org.apache.hadoop.hbase.client.Result next = rst.next();next !=null;next = rst.next() ){ 7 System.out.println(next.toString()); 8 } 9 table.close(); 1 Scan scan = new Scan(); 2 scan.setStartRow(Bytes.toBytes("1"));//包含开始行键 3 scan.setStopRow(Bytes.toBytes("5"));//不包含结束行键 4 ResultScanner rst = table.getScanner(scan); 5 System.out.println(rst.toString()); 6 for (org.apache.hadoop.hbase.client.Result next = rst.next();next !=null;next = rst.next() ){ 7 for(Cell cell:next.rawCells()){ 8 System.out.println(next.toString()); 9 System.out.println("family:" + Bytes.toString(CellUtil.cloneFamily(cell))); 10 System.out.println("col:" + Bytes.toString(CellUtil.cloneQualifier(cell))); 11 System.out.println("value" + Bytes.toString(CellUtil.cloneValue(cell))); 12 } 13 } 14 table.close(); 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.Cell; 7 import org.apache.hadoop.hbase.CellUtil; 8 import org.apache.hadoop.hbase.HBaseConfiguration; 9 import org.apache.hadoop.hbase.TableName; 10 import org.apache.hadoop.hbase.client.Delete; 11 import org.apache.hadoop.hbase.client.Get; 12 import org.apache.hadoop.hbase.client.HTable; 13 import org.apache.hadoop.hbase.client.Put; 14 import org.apache.hadoop.hbase.client.ResultScanner; 15 import org.apache.hadoop.hbase.client.Scan; 16 import org.apache.hadoop.hbase.util.Bytes; 17 18 public class HBaseTest { 19 public static void main(String[] args) throws Exception { 20 HTable table = new HTable(getConfig(),TableName.valueOf("test_table"));//表名是test_table 21 // Put put = new Put(Bytes.toBytes("row_04"));//行键是row_04 22 // put.add(Bytes.toBytes("f"),Bytes.toBytes("name"),Bytes.toBytes("Andy1"));//列簇是f,列修饰符是name,值是Andy0 23 // put.add(Bytes.toBytes("f2"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f2,列修饰符是name,值是Andy3 24 // table.put(put); 25 // table.close(); 26 27 // Get get = new Get(Bytes.toBytes("row_04")); 28 // get.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("age"));如现在这样,不指定,默认把所有的全拿出来 29 // org.apache.hadoop.hbase.client.Result rest = table.get(get); 30 // System.out.println(rest.toString()); 31 // table.close(); 32 33 // Delete delete = new Delete(Bytes.toBytes("row_2")); 34 // delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("email")); 35 // delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("name")); 36 // table.delete(delete); 37 // table.close(); 38 39 // Delete delete = new Delete(Bytes.toBytes("row_04")); 40 //// delete.deleteColumn(Bytes.toBytes("f"), Bytes.toBytes("name"));//deleteColumn是删除某一个列簇里的最新时间戳版本。 41 // delete.deleteColumns(Bytes.toBytes("f"), Bytes.toBytes("name"));//delete.deleteColumns是删除某个列簇里的所有时间戳版本。 42 // table.delete(delete); 43 // table.close(); 44 45 46 Scan scan = new Scan(); 47 scan.setStartRow(Bytes.toBytes("row_01"));//包含开始行键 48 scan.setStopRow(Bytes.toBytes("row_03"));//不包含结束行键 49 ResultScanner rst = table.getScanner(scan); 50 System.out.println(rst.toString()); 51 for (org.apache.hadoop.hbase.client.Result next = rst.next();next !=null;next = rst.next() ){ 52 for(Cell cell:next.rawCells()){ 53 System.out.println(next.toString()); 54 System.out.println("family:" + Bytes.toString(CellUtil.cloneFamily(cell))); 55 System.out.println("col:" + Bytes.toString(CellUtil.cloneQualifier(cell))); 56 System.out.println("value" + Bytes.toString(CellUtil.cloneValue(cell))); 57 } 58 } 59 table.close(); 60 } 61 62 public static Configuration getConfig(){ 63 Configuration configuration = new Configuration(); 64 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 65 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 66 return configuration; 67 } 68 } 2016-12-10 17:58:16,226 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0x7efa391e connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 17:58:16,265 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 17:58:16,267 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 17:58:16,267 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 17:58:16,267 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 17:58:16,268 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 17:58:16,268 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 17:58:16,270 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 17:58:16,271 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 17:58:16,271 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 17:58:16,271 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 17:58:16,272 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 17:58:16,272 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 17:58:16,272 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 17:58:16,273 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 17:58:16,273 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 17:58:16,278 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0x7efa391e0x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 17:58:16,408 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopSlave1/192.168.80.11:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 17:58:16,438 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopSlave1/192.168.80.11:2181, initiating session 2016-12-10 17:58:16,474 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopSlave1/192.168.80.11:2181, sessionid = 0x2587338ecb40027, negotiated timeout = 40000 org.apache.hadoop.hbase.client.ClientScanner@634be93a keyvalues={row_01/f:col/1478102698687/Put/vlen=5/seqid=0, row_01/f:name/1478104345828/Put/vlen=4/seqid=0} family:f col:col valuemaizi keyvalues={row_01/f:col/1478102698687/Put/vlen=5/seqid=0, row_01/f:name/1478104345828/Put/vlen=4/seqid=0} family:f col:name valueAndy keyvalues={row_02/f:name/1478104477628/Put/vlen=5/seqid=0} family:f col:name valueAndy2 2016-12-10 17:58:17,994 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x2587338ecb40027 2016-12-10 17:58:18,001 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x2587338ecb40027 closed 2016-12-10 17:58:18,001 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down 代码解释一 1 Scan scan = new Scan(); 2 scan.setStartRow(Bytes.toBytes("row_01"));//包含开始行键 3 scan.setStopRow(Bytes.toBytes("row_03"));//不包含结束行键 4 ResultScanner rst = table.getScanner(scan); 5 System.out.println(rst.toString()); 6 for (org.apache.hadoop.hbase.client.Result next = rst.next();next !=null;next = rst.next() ){ 7 for(Cell cell:next.rawCells()){ 8 System.out.println(next.toString()); 9 System.out.println("family:" + Bytes.toString(CellUtil.cloneFamily(cell))); 10 System.out.println("col:" + Bytes.toString(CellUtil.cloneQualifier(cell))); 11 System.out.println("value" + Bytes.toString(CellUtil.cloneValue(cell))); 12 } 13 } 14 table.close(); 代码解释二 1 Scan scan = new Scan(); 2 scan.setStartRow(Bytes.toBytes("row_01"));//包含开始行键 3 scan.setStopRow(Bytes.toBytes("row_03"));//不包含结束行键 4 ResultScanner rst = table.getScanner(scan); 5 System.out.println(rst.toString()); 6 for (org.apache.hadoop.hbase.client.Result next = rst.next();next !=null;next = rst.next() ){ 7 for(Cell cell:next.rawCells()){ 8 System.out.println(next.toString()); 9 System.out.println("family:" + Bytes.toString(CellUtil.cloneFamily(cell))); 10 System.out.println("col:" + Bytes.toString(CellUtil.cloneQualifier(cell))); 11 System.out.println("value" + Bytes.toString(CellUtil.cloneValue(cell))); 12 } 13 } 14 table.close(); 1 package zhouls.bigdata.HbaseProject.Test1; 2 3 import javax.xml.transform.Result; 4 5 import org.apache.hadoop.conf.Configuration; 6 import org.apache.hadoop.hbase.Cell; 7 import org.apache.hadoop.hbase.CellUtil; 8 import org.apache.hadoop.hbase.HBaseConfiguration; 9 import org.apache.hadoop.hbase.TableName; 10 import org.apache.hadoop.hbase.client.Delete; 11 import org.apache.hadoop.hbase.client.Get; 12 import org.apache.hadoop.hbase.client.HTable; 13 import org.apache.hadoop.hbase.client.Put; 14 import org.apache.hadoop.hbase.client.ResultScanner; 15 import org.apache.hadoop.hbase.client.Scan; 16 import org.apache.hadoop.hbase.util.Bytes; 17 18 public class HBaseTest { 19 public static void main(String[] args) throws Exception { 20 HTable table = new HTable(getConfig(),TableName.valueOf("test_table"));//表名是test_table 21 // Put put = new Put(Bytes.toBytes("row_04"));//行键是row_04 22 // put.add(Bytes.toBytes("f"),Bytes.toBytes("name"),Bytes.toBytes("Andy1"));//列簇是f,列修饰符是name,值是Andy0 23 // put.add(Bytes.toBytes("f2"),Bytes.toBytes("name"),Bytes.toBytes("Andy3"));//列簇是f2,列修饰符是name,值是Andy3 24 // table.put(put); 25 // table.close(); 26 27 // Get get = new Get(Bytes.toBytes("row_04")); 28 // get.addColumn(Bytes.toBytes("f1"), Bytes.toBytes("age"));如现在这样,不指定,默认把所有的全拿出来 29 // org.apache.hadoop.hbase.client.Result rest = table.get(get); 30 // System.out.println(rest.toString()); 31 // table.close(); 32 33 // Delete delete = new Delete(Bytes.toBytes("row_2")); 34 // delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("email")); 35 // delete.deleteColumn(Bytes.toBytes("f1"), Bytes.toBytes("name")); 36 // table.delete(delete); 37 // table.close(); 38 39 // Delete delete = new Delete(Bytes.toBytes("row_04")); 40 //// delete.deleteColumn(Bytes.toBytes("f"), Bytes.toBytes("name"));//deleteColumn是删除某一个列簇里的最新时间戳版本。 41 // delete.deleteColumns(Bytes.toBytes("f"), Bytes.toBytes("name"));//delete.deleteColumns是删除某个列簇里的所有时间戳版本。 42 // table.delete(delete); 43 // table.close(); 44 45 46 Scan scan = new Scan(); 47 scan.setStartRow(Bytes.toBytes("row_01"));//包含开始行键 48 scan.setStopRow(Bytes.toBytes("row_03"));//不包含结束行键 49 scan.addColumn(Bytes.toBytes("f"), Bytes.toBytes("name")); 50 ResultScanner rst = table.getScanner(scan);//整个循环 51 System.out.println(rst.toString()); 52 for (org.apache.hadoop.hbase.client.Result next = rst.next();next !=null;next = rst.next() ){ 53 for(Cell cell:next.rawCells()){//某个row key下的循坏 54 System.out.println(next.toString()); 55 System.out.println("family:" + Bytes.toString(CellUtil.cloneFamily(cell))); 56 System.out.println("col:" + Bytes.toString(CellUtil.cloneQualifier(cell))); 57 System.out.println("value" + Bytes.toString(CellUtil.cloneValue(cell))); 58 } 59 } 60 table.close(); 61 } 62 63 public static Configuration getConfig(){ 64 Configuration configuration = new Configuration(); 65 // conf.set("hbase.rootdir","hdfs:HadoopMaster:9000/hbase"); 66 configuration.set("hbase.zookeeper.quorum", "HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181"); 67 return configuration; 68 } 69 } 2016-12-10 18:09:00,581 INFO [org.apache.hadoop.hbase.zookeeper.RecoverableZooKeeper] - Process identifier=hconnection-0xbe4535e connecting to ZooKeeper ensemble=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 2016-12-10 18:09:00,600 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT 2016-12-10 18:09:00,601 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:host.name=WIN-BQOBV63OBNM 2016-12-10 18:09:00,601 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.version=1.7.0_51 2016-12-10 18:09:00,601 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.vendor=Oracle Corporation 2016-12-10 18:09:00,601 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.home=C:\Program Files\Java\jdk1.7.0_51\jre 2016-12-10 18:09:00,601 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.class.path=D:\Code\MyEclipseJavaCode\HbaseProject\bin;D:\SoftWare\hbase-1.2.3\lib\activation-1.1.jar;D:\SoftWare\hbase-1.2.3\lib\aopalliance-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-i18n-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\apacheds-kerberos-codec-2.0.0-M15.jar;D:\SoftWare\hbase-1.2.3\lib\api-asn1-api-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\api-util-1.0.0-M20.jar;D:\SoftWare\hbase-1.2.3\lib\asm-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\avro-1.7.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-1.7.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-beanutils-core-1.8.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-cli-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-codec-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\commons-collections-3.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-compress-1.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-configuration-1.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-daemon-1.0.13.jar;D:\SoftWare\hbase-1.2.3\lib\commons-digester-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\commons-el-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\commons-httpclient-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-io-2.4.jar;D:\SoftWare\hbase-1.2.3\lib\commons-lang-2.6.jar;D:\SoftWare\hbase-1.2.3\lib\commons-logging-1.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math-2.2.jar;D:\SoftWare\hbase-1.2.3\lib\commons-math3-3.1.1.jar;D:\SoftWare\hbase-1.2.3\lib\commons-net-3.1.jar;D:\SoftWare\hbase-1.2.3\lib\disruptor-3.3.0.jar;D:\SoftWare\hbase-1.2.3\lib\findbugs-annotations-1.3.9-1.jar;D:\SoftWare\hbase-1.2.3\lib\guava-12.0.1.jar;D:\SoftWare\hbase-1.2.3\lib\guice-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\guice-servlet-3.0.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-annotations-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-auth-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-hdfs-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-app-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-core-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-jobclient-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-mapreduce-client-shuffle-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-api-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-client-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hadoop-yarn-server-common-2.5.1.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-annotations-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-client-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-common-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-examples-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-external-blockcache-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop2-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-hadoop-compat-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-it-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-prefix-tree-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-procedure-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-protocol-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-resource-bundle-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-rest-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-server-1.2.3-tests.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-shell-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\hbase-thrift-1.2.3.jar;D:\SoftWare\hbase-1.2.3\lib\htrace-core-3.1.0-incubating.jar;D:\SoftWare\hbase-1.2.3\lib\httpclient-4.2.5.jar;D:\SoftWare\hbase-1.2.3\lib\httpcore-4.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-core-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-jaxrs-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-mapper-asl-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jackson-xc-1.9.13.jar;D:\SoftWare\hbase-1.2.3\lib\jamon-runtime-2.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-compiler-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\jasper-runtime-5.5.23.jar;D:\SoftWare\hbase-1.2.3\lib\javax.inject-1.jar;D:\SoftWare\hbase-1.2.3\lib\java-xmlbuilder-0.4.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-api-2.2.2.jar;D:\SoftWare\hbase-1.2.3\lib\jaxb-impl-2.2.3-1.jar;D:\SoftWare\hbase-1.2.3\lib\jcodings-1.0.8.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-client-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-core-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-guice-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-json-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jersey-server-1.9.jar;D:\SoftWare\hbase-1.2.3\lib\jets3t-0.9.0.jar;D:\SoftWare\hbase-1.2.3\lib\jettison-1.3.3.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-sslengine-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\jetty-util-6.1.26.jar;D:\SoftWare\hbase-1.2.3\lib\joni-2.1.2.jar;D:\SoftWare\hbase-1.2.3\lib\jruby-complete-1.6.8.jar;D:\SoftWare\hbase-1.2.3\lib\jsch-0.1.42.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\jsp-api-2.1-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\junit-4.12.jar;D:\SoftWare\hbase-1.2.3\lib\leveldbjni-all-1.8.jar;D:\SoftWare\hbase-1.2.3\lib\libthrift-0.9.3.jar;D:\SoftWare\hbase-1.2.3\lib\log4j-1.2.17.jar;D:\SoftWare\hbase-1.2.3\lib\metrics-core-2.2.0.jar;D:\SoftWare\hbase-1.2.3\lib\netty-all-4.0.23.Final.jar;D:\SoftWare\hbase-1.2.3\lib\paranamer-2.3.jar;D:\SoftWare\hbase-1.2.3\lib\protobuf-java-2.5.0.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5.jar;D:\SoftWare\hbase-1.2.3\lib\servlet-api-2.5-6.1.14.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-api-1.7.7.jar;D:\SoftWare\hbase-1.2.3\lib\slf4j-log4j12-1.7.5.jar;D:\SoftWare\hbase-1.2.3\lib\snappy-java-1.0.4.1.jar;D:\SoftWare\hbase-1.2.3\lib\spymemcached-2.11.6.jar;D:\SoftWare\hbase-1.2.3\lib\xmlenc-0.52.jar;D:\SoftWare\hbase-1.2.3\lib\xz-1.0.jar;D:\SoftWare\hbase-1.2.3\lib\zookeeper-3.4.6.jar 2016-12-10 18:09:00,603 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.library.path=C:\Program Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\SoftWare\MATLAB R2013a\runtime\win64;D:\SoftWare\MATLAB R2013a\bin;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Java\jdk1.7.0_51\bin;C:\Program Files\Java\jdk1.7.0_51\jre\bin;D:\SoftWare\apache-ant-1.9.0\bin;HADOOP_HOME\bin;D:\SoftWare\apache-maven-3.3.9\bin;D:\SoftWare\Scala\bin;D:\SoftWare\Scala\jre\bin;%MYSQL_HOME\bin;D:\SoftWare\MySQL Server\MySQL Server 5.0\bin;D:\SoftWare\apache-tomcat-7.0.69\bin;%C:\Windows\System32;%C:\Windows\SysWOW64;D:\SoftWare\SSH Secure Shell;. 2016-12-10 18:09:00,603 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.io.tmpdir=C:\Users\ADMINI~1\AppData\Local\Temp\ 2016-12-10 18:09:00,604 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:java.compiler=<NA> 2016-12-10 18:09:00,604 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.name=Windows 7 2016-12-10 18:09:00,604 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.arch=amd64 2016-12-10 18:09:00,604 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:os.version=6.1 2016-12-10 18:09:00,605 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.name=Administrator 2016-12-10 18:09:00,605 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.home=C:\Users\Administrator 2016-12-10 18:09:00,605 INFO [org.apache.zookeeper.ZooKeeper] - Client environment:user.dir=D:\Code\MyEclipseJavaCode\HbaseProject 2016-12-10 18:09:00,609 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181 sessionTimeout=180000 watcher=hconnection-0xbe4535e0x0, quorum=HadoopMaster:2181,HadoopSlave1:2181,HadoopSlave2:2181, baseZNode=/hbase 2016-12-10 18:09:00,717 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server HadoopMaster/192.168.80.10:2181. Will not attempt to authenticate using SASL (unknown error) 2016-12-10 18:09:00,729 INFO [org.apache.zookeeper.ClientCnxn] - Socket connection established to HadoopMaster/192.168.80.10:2181, initiating session 2016-12-10 18:09:01,013 INFO [org.apache.zookeeper.ClientCnxn] - Session establishment complete on server HadoopMaster/192.168.80.10:2181, sessionid = 0x15825dedcf40031, negotiated timeout = 40000 org.apache.hadoop.hbase.client.ClientScanner@12f8288e keyvalues={row_01/f:name/1478104345828/Put/vlen=4/seqid=0} family:f col:name valueAndy keyvalues={row_02/f:name/1478104477628/Put/vlen=5/seqid=0} family:f col:name valueAndy2 2016-12-10 18:09:02,563 INFO [org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation] - Closing zookeeper sessionid=0x15825dedcf40031 2016-12-10 18:09:03,395 INFO [org.apache.zookeeper.ZooKeeper] - Session: 0x15825dedcf40031 closed 2016-12-10 18:09:03,419 INFO [org.apache.zookeeper.ClientCnxn] - EventThread shut down 本文转自大数据躺过的坑博客园博客,原文链接:http://www.cnblogs.com/zlslch/p/6156343.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

OpenStack入门修炼之如何创建生产使用的openstack镜像(16)

在linux-node1节点上:、 [root@linux-node1 ~]# yum install -y openstack-nova-compute [root@linux-node1 ~]# yum install -y libvirt qemu-kvm [root@linux-node1 ~]# systemctl start libvirtd [root@linux-node1 ~]# systemctl enable libvirtd [root@linux-node1 ~]# vim /etc/nova/nova.conf 增加novncproxy的地址: novncproxy_base_url=http://192.168.56.11:6080/vnc_auto.html [root@linux-node1 ~]# systemctl start openstack-nova-compute [root@linux-node1 ~]# systemctl enable openstack-nova-compute [root@linux-node1 ~]# source admin-openstack [root@linux-node1 ~]# nova service-list 当需要删除该节点时,只能从命令行进行删除:nova service-delete ID。在horizon界面上是只能关闭服务,无法进行删除。 创建openstack镜像的过程: (1)创建一个虚拟机硬盘,格式qcow2,大小为10G [root@linux-node1 ~]# qemu-img create -f qcow2 /tmp/centos.qcow2 10G Formatting '/tmp/centos.qcow2', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16 (2)创建虚拟机 [root@linux-node1 ~]# virt-install --virt-type kvm --name centos --ram 1024 \ --disk /tmp/centos.qcow2,format=qcow2 \ --network network=default \ --graphics vnc,listen=0.0.0.0 --noautoconsole \ --os-type=linux --os-variant=centos7.0 \ --location=/tmp/CentOS-7-x86_64-Minimal-1511.iso [root@linux-node1 ~]# virsh list --all Id 名称 状态 ---------------------------------------------------- - centos 关闭 [root@linux-node1 ~]# virsh start centos (3)TightVNC链接192.168.56.11进入系统安装 只分根分区,私有云不分swap分区 (4)启动虚拟机 [root@linux-node1 ~]# virsh start centos (5)在虚拟机内安装默认的软件,或基础优化 yum install net-tools tree screen wget git vim (6)openstack上传镜像 [root@linux-node1 ~]# openstack image create "Centos-7-x86_64" --file=/tmp/centos.qcow2 --disk-format qcow2 --container-format bare --public +------------------+------------------------------------------------------+ | Field | Value | +------------------+------------------------------------------------------+ | checksum | 4ac6fb14f7e5bb3c9889df4bda71474a | | container_format | bare | | created_at | 2017-12-07T08:06:55Z | | disk_format | qcow2 | | file | /v2/images/5aa6e9a1-4aea-467c-a684-51080c326887/file | | id | 5aa6e9a1-4aea-467c-a684-51080c326887 | | min_disk | 0 | | min_ram | 0 | | name | Centos-7-x86_64 | | owner | 21a45d59913d4c05b46ad3ec92e61656 | | protected | False | | schema | /v2/schemas/image | | size | 1145896960 | | status | active | | tags | | | updated_at | 2017-12-07T08:08:42Z | | virtual_size | None | | visibility | public | +------------------+------------------------------------------------------+ [root@linux-node1 ~]# openstack image list +--------------------------------------+-----------------+--------+ | ID | Name | Status | +--------------------------------------+-----------------+--------+ | 5aa6e9a1-4aea-467c-a684-51080c326887 | Centos-7-x86_64 | active | | 51e1e125-dbe3-49c6-a3d5-55c89f195f55 | cirros | active | +--------------------------------------+-----------------+--------+ (7)通过上传的镜像创建centos7云主机 使用admin账户创建云主机类型,后使用demo用户进行创建云主机 本文转自 IT_外卖小哥 51CTO博客,原文链接:http://blog.51cto.com/jinlong/2049779

优秀的个人博客,低调大师

OpenStack入门修炼之KVM虚拟机介绍和管理(4)

1.查看虚拟机,启动虚拟机 [root@linux-node1 ~]# virsh list --all Id Name State ---------------------------------------------------- - CentOS-7-x86_64 shut off [root@linux-node1 ~]# virsh start CentOS-7-x86_64 通过TightVNC连接,修改网络vi /etc/sysconfig/network-scripts/ifcfg-eth0 tips: KVM虚拟机在宿主机上的体现是一个进程,可以通过ps axu |grep kvm进行查看。对KVM的管理,就是在宿主机上对KVM的进程进行管理。 2.libvirt介绍 libvirt组成部分:libvirt daemon后台进程,libvirt API库,User-space management tools tips: (1)如果libvirtd服务停用了,会影响命令行管理虚拟机,但不会影响虚拟机本身的运行。 (2)kvm是为openstack进行创建虚拟机,如果openstack服务停用,可以使用libvirtd服务命令行进行管理。 3.KVM常用管理:CPU,内存,网络 (1)libvirt通过对xml文件进行管理 [root@linux-node1 ~]# cd /etc/libvirt/qemu [root@linux-node1 qemu]# ls -l total 8 -rw-------. 1 root root 3855 Nov 27 10:00 CentOS-7-x86_64.xml drwx------. 3 root root 4096 Nov 27 09:33 networks (2)CentOS-7-x86_64.xml是自动生成的,无法进行修改。如果需要修改,需要通过virsh edit进行编辑。但是在openstack上是无法进行修改的。 [root@linux-node1 qemu]# virsh edit CentOS-7-x86_64 (3)KVM修改热添加:virsh edit CentOS-7-x86_64,热添加会影响系统的性能,不适合在生产环境使用 tips:KVM支持热添加,公有云是不支持热添加的。需要宿主机和虚拟机的系统保持一致性。 ①cpu的热添加,将cpu核数改为2,openstack不支持 修改为: [root@linux-node1 qemu]# virsh setvcpus CentOS-7-x86_64 2 --live ②内存热添加 a.查看KVM内存: [root@linux-node1 ~]# virsh qemu-monitor-command CentOS-7-x86_64 --hmp --cmd info balloon balloon: actual=1024 b.修改,将内存调成512M: [root@linux-node1 ~]# virsh qemu-monitor-command CentOS-7-x86_64 --hmp --cmd balloon 512 c.增加内存:修改xml文件,修改完xml文件需要重启虚拟机 <memory unit='KiB'>1048576</memory> 修改为: <memory unit='KiB'>1548576</memory> <currentMemory unit='KiB'>1048576</currentMemory> [root@linux-node1 ~]# virsh shutdown CentOS-7-x86_64 [root@linux-node1 ~]# virsh start CentOS-7-x86_64 (4)网络管理,配置KVM的桥接网络 [root@linux-node1 ~]# brctl show bridge name bridge id STP enabled interfaces virbr0 8000.52540067fb26 yes virbr0-nic vnet ①创建桥接网卡,写成脚本 [root@linux-node1 ~]# vim bridge.sh #!/bin/bash brctl addbr br0 brctl addif br0 ens33 ip addr del dev ens33 192.168.56.11/24 ifconfig br0 192.168.56.11/24 up route add default gw 192.168.56.2 [root@linux-node1 ~]# brctl show bridge name bridge id STP enabled interfaces br0 8000.000c2903f3fe no eth0 virbr0 8000.52540067fb26 yes virbr0-nic vnet0 ②修改xml [root@linux-node1 ~]# virsh edit CentOS-7-x86_64 interface type='network' 修改为 interface type='bridge' source network='default'/ 修改为 source bridge='br0'/ ③重启KVM虚拟机 [root@linux-node1 ~]# virsh shutdown CentOS-7-x86_64 Domain CentOS-7-x86_64 is being shutdown [root@linux-node1 ~]# virsh start CentOS-7-x86_64 Domain CentOS-7-x86_64 started ④修改虚拟机网卡配置 [root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0 TYPE=Ethernet BOOTPROTO=static NAME=eth0 ONBOOT=yes IPADDR=192.168.56.111 NETMASK=255.255.255.0 GATEWAY=192.168.56.2 [root@localhost ~]# systemctl restart network ⑤验证宿主机上能否登陆 [root@linux-node1 ~]# ping 192.168.56.111 PING 192.168.56.111 (192.168.56.111) 56(84) bytes of data. 64 bytes from 192.168.56.111: icmp_seq=1 ttl=64 time=0.618 ms 64 bytes from 192.168.56.111: icmp_seq=2 ttl=64 time=0.387 ms 64 bytes from 192.168.56.111: icmp_seq=3 ttl=64 time=0.264 ms 64 bytes from 192.168.56.111: icmp_seq=4 ttl=64 time=0.328 ms ^C --- 192.168.56.111 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3002ms rtt min/avg/max/mdev = 0.264/0.399/0.618/0.134 ms [root@linux-node1 ~]# ssh 192.168.56.111 The authenticity of host '192.168.56.111 (192.168.56.111)' can't be established. ECDSA key fingerprint is SHA256:k6ODnQ4pdtSMtYrfti2wB8eB5/XfCENW0SWApJrHTgY. ECDSA key fingerprint is MD5:06:9f:34:32:b8:b2:a3:91:12:f9:3b:8c:dd:c0:e7:63. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.56.111' (ECDSA) to the list of known hosts. root@192.168.56.111's password: Last login: Mon Nov 27 11:44:22 2017 版权声明:原创作品,谢绝转载。否则将追究法律责任 本文转自 IT_外卖小哥 51CTO博客,原文链接:http://blog.51cto.com/jinlong/2049418

优秀的个人博客,低调大师

OpenStack入门修炼之KVM性能优化及IO缓存介绍(5)

1.KVM的性能优化,介绍CPU,内存,IO性能优化 KVM CPU-->qemu进行模拟 ring 3-->用户应用 (用户态,用户空间) ring 0-->操作系统 (内核态,内核空间) 虚拟化难题? (1)CPU优化: 上下文切换: 宿主机 ring 0 ring 3 虚拟机 ring 0 ring 3 处理器设置-->Inter VT-x/EPT或AMD-V/RVI(V) 缓存: L1-->静态内存 L2、L3-->动态内存 虚拟机在宿主机上是一个进程,受进程调度器的管理。容易导致Cache miss,为了减少缓存miss,可以通过taskset进行设定,把某个进程绑定到CPU的某个核上,进行提高性能。openstack上是无法进行绑定。 taskset -cp 1 25718 (2)内存优化: 空间优化 寻址 物理在使用内存的时候:虚拟内存-->映射-->物理内存,使用KVM的时候会有如下内存使用过程 虚拟机:虚拟内存 ↓映射 虚拟机:物理内存 ↓映射 宿主机:虚拟内存 ↓映射 宿主机:物理内存 影子页表技术 加速寻址技术: Inter的EPT技术,内存优化技术,可以加速虚拟机到物理内存的映射 cat /proc/meminfo/ 默认内存是4k,内存是分页的。大页内存 [root@linux-node1 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled [always] madvise never ksmd内存合并,扫描内存地址,把相同的内容进行合并释放,减少内存的占用 [root@linux-node1 ~]# ps axu |grep ksm root 27 0.0 0.0 0 0 ? SN 09:06 0:00 [ksmd] (3)I/O优化: ①通过virtio技术,加速io访问,linux默认就有这个功能,windows需要装载驱动 ②IO调度算法 内核2.6有4种调度算法:Noop CFQ AS Deadline 默认CFQ 内核3.10有3中调度算法:Noop CFQ Deadline 默认Deadline 查看默认的IO调度算法 [root@linux-node1 ~]# dmesg |grep -i scheduler [ 0.300671] io scheduler noop registered [ 0.300674] io scheduler deadline registered (default) [ 0.300691] io scheduler cfq registered Noop算法: 按顺序来,最简单的的I/O调度算法。该算法仅适当合并用户请求,并不排序请求:新的请求通常被插在调度队列的开头或末尾,下一个要处理的请求总是队列中的第一个请求。SSD必须设置Noop,性能最优。 2.KVM的IO缓存介绍 服务器的硬盘缓存是关闭的,因为会使用RAID卡缓存,RAID带电池,不会在断电的时候丢失数据。 虚拟机的应用程序写数据的方式选择: KVM默认的方式是WriteThrough,最安全的,但是性能也最差。 本文转自 IT_外卖小哥 51CTO博客,原文链接:http://blog.51cto.com/jinlong/2049435

优秀的个人博客,低调大师

Hadoop入门进阶课程7--Pig介绍、安装与应用案例

本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,博主为石山园,博客地址为http://www.cnblogs.com/shishanyuan。该系列课程是应邀实验楼整理编写的,这里需要赞一下实验楼提供了学习的新方式,可以边看博客边上机实验,课程地址为https://www.shiyanlou.com/courses/237 【注】该系列所使用到安装包、测试数据和代码均可在百度网盘下载,具体地址为http://pan.baidu.com/s/10PnDs,下载该PDF文件 1、搭建环境 部署节点操作系统为CentOS,防火墙和SElinux禁用,创建了一个shiyanlou用户并在系统根目录下创建/app目录,用于存放Hadoop等组件运行包。因为该目录用于安装hadoop等组件程序,用户对shiyanlou必须赋予rwx权限(一般做法是root用户在根目录下创建/app目录,并修改该目录拥有者为shiyanlou(chown–R shiyanlou:shiyanlou /app)。 Hadoop搭建环境: l虚拟机操作系统:CentOS6.664位,单核,1G内存 lJDK:1.7.0_55 64位 lHadoop:1.1.2 2、Pig介绍 Pig是yahoo捐献给apache的一个项目,使用SQL-like语言,是在MapReduce上构建的一种高级查询语言,把一些运算编译进MapReduce模型的Map和Reduce中。Pig有两种运行模式:Local模式和MapReduce模式 l本地模式:Pig运行于本地模式,只涉及到单独的一台计算机 lMapReduce模式:Pig运行于MapReduce模式,需要能访问一个Hadoop集群,并且需要装上HDFS Pig的调用方式: lGrunt shell方式:通过交互的方式,输入命令执行任务; lPig script方式:通过script脚本的方式来运行任务; 嵌入式方式:嵌入java源代码中,通过java调用来运行任务。 3、搭建Pig环境 3.1下载并解压安装包 在Apache下载最新的Pig软件包,点击下载会推荐最快的镜像站点,以下为下载地址:http://mirror.bit.edu.cn/apache/pig/ 也可以在/home/shiyanlou/install-pack目录中找到该安装包,解压该安装包并把该安装包复制到/app目录中 cd /home/shiyanlou/install-pack tar -xzf pig-0.13.0.tar.gz mv pig-0.13.0 /app 3.2设置环境变量 使用如下命令编辑/etc/profile文件: sudo vi /etc/profile 设置pig的class路径和在path加入pig的路径,其中PIG_CLASSPATH参数是设置pig在MapReduce工作模式: export PIG_HOME=/app/pig-0.13.0 export PIG_CLASSPATH=/app/hadoop-1.1.2/conf export PATH=$PATH:$PIG_HOME/bin 编译配置文件/etc/profile,并确认生效 source /etc/profile echo $PATH 3.3验证安装完成 重新登录终端,确保hadoop集群启动,键入pig命令,应该能看到pig连接到hadoop集群的信息并且进入了grunt shell命令行模式: 4、测试例子 4.1测试例子内容 在/home/shiyanlou/install-pack/class7中有website_log.zip测试数据文件,该文件是某网站访问日志,请大家使用pig计算出每个ip的点击次数,例如123.24.56.57 13 24.53.23.123 7 34.56.78.120 20 ....等等 4.2程序代码 1 //加载HDFS中访问日志,使用空格进行分割,只加载ip列 2 records = LOAD 'hdfs://hadoop:9000/class7/input/website_log.txt' USING PigStorage(' ') AS (ip:chararray); 3 4 // 按照ip进行分组,统计每个ip点击数 5 records_b = GROUP records BY ip; 6 records_c = FOREACH records_b GENERATE group,COUNT(records) AS click; 7 8 // 按照点击数排序,保留点击数前10个的ip数据 9 records_d = ORDER records_c by click DESC; 10 top10 = LIMIT records_d 10; 11 12 // 把生成的数据保存到HDFS的class7目录中 13 STORE top10 INTO 'hdfs://hadoop:9000/class7/out'; 4.3准备数据 可以在/home/shiyanlou/install-pack/class7中找到本节使用的测试数据website_log.zip文件,使用unzip文件解压缩,然后调用hadoop上传本地文件命令把该文件传到HDFS中的/class7目录,如下图所示: cd /home/shiyanlou/install-pack/class7 unzip website_log.zip ll hadoop fs -mkdir /class7/input hadoop fs -copyFromLocal website_log.txt /class7/input hadoop fs -cat /class7/input/website_log.txt | less 4.4实现过程 4.4.1输入代码 进入pig shell命令行模式: 输入代码: 4.4.2运行过程 在执行过程中在JobTracker页面观察运行情况,链接地址为:http://**.***.**.***:50030/jobtracker.jsp 点击查看具体作业信息 可以观察到本次任务分为4个作业,每个作业一次在上一次作业的结果上进行计算 4.4.3运行结果 通过以下命令查看最后的结果: hadoop fs -ls /class7/out hadoop fs -cat /class7/out/part-r-00000 本文转自shishanyuan博客园博客,原文链接:http://www.cnblogs.com/shishanyuan/p/4648015.html ,如需转载请自行联系原作者

优秀的个人博客,低调大师

Hadoop入门进阶课程9--Mahout介绍、安装与应用案例

本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,博主为石山园,博客地址为http://www.cnblogs.com/shishanyuan。该系列课程是应邀实验楼整理编写的,这里需要赞一下实验楼提供了学习的新方式,可以边看博客边上机实验,课程地址为https://www.shiyanlou.com/courses/237 【注】该系列所使用到安装包、测试数据和代码均可在百度网盘下载,具体地址为http://pan.baidu.com/s/10PnDs,下载该PDF文件 1、搭建环境 部署节点操作系统为CentOS,防火墙和SElinux禁用,创建了一个shiyanlou用户并在系统根目录下创建/app目录,用于存放Hadoop等组件运行包。因为该目录用于安装hadoop等组件程序,用户对shiyanlou必须赋予rwx权限(一般做法是root用户在根目录下创建/app目录,并修改该目录拥有者为shiyanlou(chown–R shiyanlou:shiyanlou /app)。 Hadoop搭建环境: l虚拟机操作系统:CentOS6.664位,单核,1G内存 lJDK:1.7.0_55 64位 lHadoop:1.1.2 2、Mahout介绍 Mahout是Apache Software Foundation(ASF) 旗下的一个开源项目,提供一些可扩展的机器学习领域经典算法的实现,旨在帮助开发人员更加方便快捷地创建智能应用程序。AMahout包含许多实现,包括聚类、分类、推荐过滤、频繁子项挖掘。此外,通过使用Apache Hadoop库,Mahout可以有效地扩展到云中。 Mahout的意思是大象的饲养者及驱赶者。Mahout这个名称来源于该项目(有时)使用Apache Hadoop—其徽标上有一头黄色的大象 —来实现可伸缩性和容错性。 Mahout项目是由Apache Lucene(开源搜索)社区中对机器学习感兴趣的一些成员发起的,他们希望建立一个可靠、文档翔实、可伸缩的项目,在其中实现一些常见的用于集群和分类的机器学习算法。该社区最初基于Ng et al.的文章 “Map-Reduce for Machine Learning on Multicore”(见 参考资料),但此后在发展中又并入了更多广泛的机器学习方法。Mahout的目标还包括: l建立一个用户和贡献者社区,使代码不必依赖于特定贡献者的参与或任何特定公司和大学的资金。 l专注于实际用例,这与高新技术研究及未经验证的技巧相反。 l提供高质量文章和示例 3、搭建Mahout环境 3.1部署过程 3.1.1下载Mahout 在Apache下载最新的Mahout软件包,点击下载会推荐最快的镜像站点,以下为下载地址:http://archive.apache.org/dist/mahout/0.6/ 也可以在/home/shiyanlou/install-pack目录中找到该安装包,解压该安装包并把该安装包复制到/app目录中 cd /home/shiyanlou/install-pack tar -xzf mahout-distribution-0.6.tar.gz mv mahout-distribution-0.6 /app/mahout-0.6 3.1.2设置环境变量 使用如下命令编辑/etc/profile文件: sudo vi /etc/profile 声明mahout的home路径和在path加入bin的路径: export MAHOUT_HOME=/app/mahout-0.6 export MAHOUT_CONF_DIR=/app/mahout-0.6/conf export PATH=$PATH:$MAHOUT_HOME/bin 编译配置文件/etc/profile,并确认生效 source /etc/profile echo $PATH 3.1.3验证安装完成 重新登录终端,确保hadoop集群启动,键入mahout --help命令,检查Mahout是否安装完好,看是否列出了一些算法: mahout --help 3.2测试例子 3.2.1下载测试数据 下载一个文件synthetic_control.data,下载地址http://archive.ics.uci.edu/ml/databases/synthetic_control/synthetic_control.data,也可以在/home/shiyanlou/install-pack/class9目录中找到该测试数据文件,把这个文件放在$MAHOUT_HOME/testdata目录下 cd /home/shiyanlou/install-pack/class9 mkdir /app/mahout-0.6/testdata mv synthetic_control.data /app/mahout-0.6/testdata 3.2.2启动Hadoop 通过下面命令启动hadoop并通过jps查看进程 cd /app/hadoop-1.1.2/bin ./start-all.sh jps 3.2.3使用kmeans算法 使用如下命令进行kmeans算法测试: cd /app/mahout-0.6/ mahout org.apache.mahout.clustering.syntheticcontrol.kmeans.Job 这里需要说明下,当你看到下面的代码时以为是错的,其实不是,原因:MAHOUT_LOCAL:设置是否本地运行,如果设置该参数就不会在hadoop运行了,一旦设置这个参数那HADOOP_CONF_DIR和HADOOP_HOME两个参数就自动失效了。 MAHOUT_LOCAL is not set, so we don't add HADOOP_CONF_DIR to classpath. no HADOOP_HOME set , running locally 3.2.4查看结果 结果会在根目录建立output新文件夹,如果下图结果表示mahout安装正确且运行正常: cd /app/mahout-0.6/output ll 4、测试例子:运行20newsgroup 4.1算法流程 朴素贝叶斯分类是一种十分简单的分类算法,朴素贝叶斯的思想基础是这样的:对于给出的待分类项,求解在此项出现的条件下各个类别出现的概率哪个最大,就认为此待分类项属于哪个类别。 这二十个新闻组数据集合是收集大约20,000新闻组文档,均匀的分布在20个不同的集合。这20个新闻组集合采集最近流行的数据集合到文本程序中作为实验,根据机器学习技术。例如文本分类,文本聚集。我们将使用Mahout的Bayes Classifier创造一个模型,它将一个新文档分类到这20个新闻组集合范例演示 4.2实现过程(mahout 0.6版本) 4.2.1下载数据并解压数据 下载20Newsgroups数据集,地址为http://qwone.com/~jason/20Newsgroups/,下载20news-bydate.tar.gz数据包,也可以在/home/shiyanlou/install-pack/class9目录中找到该测试数据文件: 解压20news-bydate.tar.gz数据包,解压后可以看到两个文件夹,分别为训练原始数据和测试原始数据: cd /home/shiyanlou/install-pack/class9 tar -xzf 20news-bydate.tar.gz 在mahout根目录下建data文件夹,然后把20news训练原始数据和测试原始数据迁移到该文件夹下: mkdir /app/mahout-0.6/data mv 20news-bydate-t* /app/mahout-0.6/data ll /app/mahout-0.6/data 4.2.2建立训练集 通过如下命令建立训练集,训练的数据在20news-bydate-train目录中,输出的训练集目录为bayes-train-input: cd /app/mahout-0.6 mahout org.apache.mahout.classifier.bayes.PrepareTwentyNewsgroups \ -p /app/mahout-0.6/data/20news-bydate-train \ -o /app/mahout-0.6/data/bayes-train-input \ -a org.apache.mahout.vectorizer.DefaultAnalyzer \ -c UTF-8 4.2.3建立测试集 通过如下命令建立训练集,训练的数据在20news-bydate-test目录中,输出的训练集目录为bayes-test-input: mahout org.apache.mahout.classifier.bayes.PrepareTwentyNewsgroups \ -p /app/mahout-0.6/data/20news-bydate-test \ -o /app/mahout-0.6/data/bayes-test-input \ -a org.apache.mahout.vectorizer.DefaultAnalyzer \ -c UTF-8 4.2.4上传数据到HDFS 在HDFS中新建/class9/20news文件夹,把生成的训练集和测试集上传到HDFS的/class9/20news目录中: hadoop fs -mkdir /class9/20news hadoop fs -put /app/mahout-0.6/data/bayes-train-input /class9/20news hadoop fs -put /app/mahout-0.6/data/bayes-test-input /class9/20news hadoop fs -ls /class9/20news hadoop fs -ls /class9/20news/bayes-test-input 4.2.5训练贝叶斯分类器 使用trainclassifier类训练在HDFS中/class9/20news/bayes-train-input的数据,生成的模型放到/class9/ 20news/newsmodel目录中: mahout trainclassifier \ -i /class9/20news/bayes-train-input \ -o /class9/20news/newsmodel \ -type cbayes \ -ng 2 \ -source hdfs 4.2.6观察训练作业运行过程 注:实验楼为命令行界面,无法观测到该步骤界面,以下描述仅做参考 在训练过程中在JobTracker页面观察运行情况,链接地址为http://**.***.**.***:50030/jobtracker.jsp,训练任务四个作业,大概运行了15分钟左右: 点击查看具体作业信息 map运行情况 作业运行情况 4.2.7查看生成模型 通过如下命令查看模型内容: hadoop fs -ls /class9/20news hadoop fs -ls /class9/20news/newsmodel hadoop fs -ls /class9/20news/newsmodel/trainer-tfIdf 4.2.8测试贝叶斯分类器 使用testclassifier类训练在HDFS中./20news/bayestest-input的数据,使用的模型路径为./ 20news/newsmodel: mahout testclassifier \ -m /class9/20news/newsmodel \ -d /class9/20news/bayes-test-input \ -type cbayes \ -ng 2 \ -source hdfs \ -method mapreduce 4.2.9观察训练作业运行过程 注:实验楼为命令行界面,无法观测到该步骤界面,以下描述仅做参考 在执行过程中在JobTracker页面观察运行情况,链接地址为http://hadoop:50030/jobtracker.jsp,训练任务1个作业,大概运行了5分钟左右: 作业的基本信息 map运行情况 reduce运行情况 4.2.10查看结果 这个混合矩阵的意思说明:上述a到u分别是代表了有20类别,这就是我们之前给的20个输入文件,列中的数据说明每个类别中被分配到的字节个数,classified说明应该被分配到的总数 38100009100010020100300|398a = rec.motorcycles 意思为rec.motorcycles本来是属于a,有381篇文档被划为了a类,这个是正确的数据,其它的分别表示划到b~u类中的数目。我们可以看到其正确率为381/398=0.9573 ,可见其正确率还是很高的了。 4.3实现过程(mahout 0.7+版本) 在0.7版本的安装目录下$MAHOUT_HOME/examples/bin下有个脚本文件classifu-20newsgroups.sh,这个脚本中执行过程是和前面分布执行结果是一致的,只不过将各个API用shell脚本封装到一起了。从0.7版本开始,Mahout移除了命令行调用的API:prepare20newsgroups、trainclassifier和testclassifier,只能通过shell脚本执行。 执行$MAHOUT_HOME/examples/bin/classify-20newsgroups.sh四个选项中选择第一个选项, 执行结果如下: 5、问题解决 5.1使用mahout0.7+版本对20Newsgroup数据建立训练集时出错 使用如下命令对20Newsgroupt数据建立训练集时: mahout org.apache.mahout.classifier.bayes.PrepareTwentyNewsgroups \ -p /app/mahout-0.9/data/20news-bydate-train \ -o /app/mahout-0.9/data/bayes-train-input \ -a org.apache.mahout.vectorizer.DefaultAnalyzer\ -c UTF-8 出现如下错误,原因在于从0.7版本开始,Mahout移除了命令行调用的prepare20newsgroups、trainclassifier和testclassifier API,只能通过shell脚本执行$MAHOUT_HOME/examples/bin/classify-20newsgroups.sh进行 14/12/7 21:31:35 WARN driver.MahoutDriver: Unable to add class: org.apache.mahout.classifier.bayes.PrepareTwentyNewsgroups 14/12/7 21:31:35 WARN driver.MahoutDriver: No org.apache.mahout.classifier.bayes.PrepareTwentyNewsgroups.props found on classpath, will use command-line arguments only Unknown program 'org.apache.mahout.classifier.bayes.PrepareTwentyNewsgroups' chosen. Valid program names are: arff.vector: : Generate Vectors from an ARFF file or directory baumwelch: : Baum-Welch algorithm for unsupervised HMM training ....... 本文转自shishanyuan博客园博客,原文链接: http://www.cnblogs.com/shishanyuan/p/4648258.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

Android JNI入门第三篇——jni头文件分析

一、 首先写了java文件: publicclassHeaderFile{ privatenativevoiddoVoid(); nativeintdoShort(); nativevoiddoArray(Object[]o); nativeintdoInt(inti);//byte,short,int,long,float,double,boolean,char nativeintdoInt(doubled);//byte,short,int,long,float,double,boolean,char nativeintdoInt(Objecto); nativeintdoInt(doubled1,doubled2); staticnativeintdoInt(doubled1,doubled2,doubled3); staticnativeintdoInt(doubled1,floatf,booleanb,char[]c); nativeintdoInt(int[]i); nativeintdoInt(int[]i1,double[]i2); staticnativeintdoInt(int[]i1,double[]i2,Object[]o); publicnativeStringdoString(Strings); publicnativeObjectdoObject(Objecto); publicnativeEnumerationdoInterface(Iteratorit); publicnativeStudentdoStudent(Students); //nativeint[]doInt(int[]i);//byte,short,int,long,float,double,boolean,char publicnativeString[]doString(String[]s); publicnativeObject[]doObjects(Object[]o); publicnativeEnumeration[]doInterface(Iterator[]it); publicnativeStudent[]doStudent(Student[]s); publicnativestaticObjectdoAll(int[]i,String[]s,Student[]student); } java文件中包含了private、public、protect等类型的方法,static 方法和非static 方法,返回类型有基础类型、对象等。 二、下面看一下生成的头文件: /*DONOTEDITTHISFILE-itismachinegenerated*/ #include<jni.h> /*Headerforclasscom_nedu_jni_helloword_HeaderFile*/ #ifndef_Included_com_nedu_jni_helloword_HeaderFile #define_Included_com_nedu_jni_helloword_HeaderFile #ifdef__cplusplus extern"C"{ #endif /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doVoid *Signature:()V */ JNIEXPORTvoidJNICALLJava_com_nedu_jni_helloword_HeaderFile_doVoid (JNIEnv*,jobject); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doShort *Signature:()I */ JNIEXPORTjintJNICALLJava_com_nedu_jni_helloword_HeaderFile_doShort (JNIEnv*,jobject); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doArray *Signature:([Ljava/lang/Object;)V */ JNIEXPORTvoidJNICALLJava_com_nedu_jni_helloword_HeaderFile_doArray (JNIEnv*,jobject,jobjectArray); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doInt *Signature:(I)I */ JNIEXPORTjintJNICALLJava_com_nedu_jni_helloword_HeaderFile_doInt__I (JNIEnv*,jobject,jint); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doInt *Signature:(D)I */ JNIEXPORTjintJNICALLJava_com_nedu_jni_helloword_HeaderFile_doInt__D (JNIEnv*,jobject,jdouble); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doInt *Signature:(Ljava/lang/Object;)I */ JNIEXPORTjintJNICALLJava_com_nedu_jni_helloword_HeaderFile_doInt__Ljava_lang_Object_2 (JNIEnv*,jobject,jobject); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doInt *Signature:(DD)I */ JNIEXPORTjintJNICALLJava_com_nedu_jni_helloword_HeaderFile_doInt__DD (JNIEnv*,jobject,jdouble,jdouble); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doInt *Signature:(DDD)I */ JNIEXPORTjintJNICALLJava_com_nedu_jni_helloword_HeaderFile_doInt__DDD (JNIEnv*,jclass,jdouble,jdouble,jdouble); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doInt *Signature:(DFZ[C)I */ JNIEXPORTjintJNICALLJava_com_nedu_jni_helloword_HeaderFile_doInt__DFZ_3C (JNIEnv*,jclass,jdouble,jfloat,jboolean,jcharArray); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doInt *Signature:([I)I */ JNIEXPORTjintJNICALLJava_com_nedu_jni_helloword_HeaderFile_doInt___3I (JNIEnv*,jobject,jintArray); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doInt *Signature:([I[D)I */ JNIEXPORTjintJNICALLJava_com_nedu_jni_helloword_HeaderFile_doInt___3I_3D (JNIEnv*,jobject,jintArray,jdoubleArray); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doInt *Signature:([I[D[Ljava/lang/Object;)I */ JNIEXPORTjintJNICALLJava_com_nedu_jni_helloword_HeaderFile_doInt___3I_3D_3Ljava_lang_Object_2 (JNIEnv*,jclass,jintArray,jdoubleArray,jobjectArray); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doString *Signature:(Ljava/lang/String;)Ljava/lang/String; */ JNIEXPORTjstringJNICALLJava_com_nedu_jni_helloword_HeaderFile_doString__Ljava_lang_String_2 (JNIEnv*,jobject,jstring); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doObject *Signature:(Ljava/lang/Object;)Ljava/lang/Object; */ JNIEXPORTjobjectJNICALLJava_com_nedu_jni_helloword_HeaderFile_doObject (JNIEnv*,jobject,jobject); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doInterface *Signature:(Ljava/util/Iterator;)Ljava/util/Enumeration; */ JNIEXPORTjobjectJNICALLJava_com_nedu_jni_helloword_HeaderFile_doInterface__Ljava_util_Iterator_2 (JNIEnv*,jobject,jobject); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doStudent *Signature:(Lcom/nedu/jni/helloword/Student;)Lcom/nedu/jni/helloword/Student; */ JNIEXPORTjobjectJNICALLJava_com_nedu_jni_helloword_HeaderFile_doStudent__Lcom_nedu_jni_helloword_Student_2 (JNIEnv*,jobject,jobject); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doString *Signature:([Ljava/lang/String;)[Ljava/lang/String; */ JNIEXPORTjobjectArrayJNICALLJava_com_nedu_jni_helloword_HeaderFile_doString___3Ljava_lang_String_2 (JNIEnv*,jobject,jobjectArray); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doObjects *Signature:([Ljava/lang/Object;)[Ljava/lang/Object; */ JNIEXPORTjobjectArrayJNICALLJava_com_nedu_jni_helloword_HeaderFile_doObjects (JNIEnv*,jobject,jobjectArray); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doInterface *Signature:([Ljava/util/Iterator;)[Ljava/util/Enumeration; */ JNIEXPORTjobjectArrayJNICALLJava_com_nedu_jni_helloword_HeaderFile_doInterface___3Ljava_util_Iterator_2 (JNIEnv*,jobject,jobjectArray); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doStudent *Signature:([Lcom/nedu/jni/helloword/Student;)[Lcom/nedu/jni/helloword/Student; */ JNIEXPORTjobjectArrayJNICALLJava_com_nedu_jni_helloword_HeaderFile_doStudent___3Lcom_nedu_jni_helloword_Student_2 (JNIEnv*,jobject,jobjectArray); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doAll *Signature:([I[Ljava/lang/String;[Lcom/nedu/jni/helloword/Student;)Ljava/lang/Object; */ JNIEXPORTjobjectJNICALLJava_com_nedu_jni_helloword_HeaderFile_doAll (JNIEnv*,jclass,jintArray,jobjectArray,jobjectArray); #ifdef__cplusplus } #endif #endif 三、头文件分析如下: 1、文件的前九行就不用说了,他们是是C、C++的头,应该很好理解。 2、方法的注释部分,每个方法都有它的注释部分,这些都是相似的,对其中一个分析: /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doVoid *Signature:()V */ 注释部分分为三部分Class、Method、Signature。 Class:表示Native方法的类名称。 Method:表示方法名称 Signature:是方法的标识,它是一个标识符,主要供我们在JNI操作java对象的方法使用的。 Signature一般是两部分构成,一个方法的参数,另一个是返回类型。方法参数在括号里面,返回类型在后面, 例如 ()V返回为void,没有参数。 (DFZ[C)I返回为int,参数为double、float、char[] (Ljava/lang/String;)Ljava/lang/String;返回String,参数为String 如果不清楚其中的字符含义,就不能知道其中的意思,其中字符对应有基本类型、对象类型、数组类型。分析如下 1)基本类型的对应关系如下: 2)方法参数或者返回值为java中的对象时,必须以“L”加上其路径,不过此路径必须以“/”分开,自定义的对象也使用本规则,不在包中时直接“L”加上类名称。比如说java.lang.String为“java/lang/String”,com.nedu.jni.helloword.Student为"com/nedu/jni/helloword/Student" 3)方法参数或者返回值为数组时类型前加上[,例如[I表示int[],[[[D表示 double[][][],即几维数组就加几个[。 看一下例子: 3、方法的声明 JNIEXPORTvoidJNICALLJava_com_nedu_jni_helloword_HeaderFile_doArray(JNIEnv*,jobject,jobjectArray); 从上面的头文件可以看出方法基本有7部分组成。 1、3部分是都是JNI的关键字,表示此函数是要被JNI调用的。 2、表示方法的返回类型 4、为JNI中标识此方法来源于java的标识头 5、方法所在类的包名+类名 6、方法名 7、参数,它们有一个共同的特点,包含JNIEnv *――它是一个接口指针,用于定位函数表中的函数! 在JNI规范中一般称 为 “Interface Pointer”。看到这儿好像和过程调用很类似了!是的,JNI中 的操作过程,就是面向过程的!后面的jobject是 一个指向该类的指针,类似与C语言中的this。这个 第二个参数是变化的,当该方法为类的实例方法时该参数为jobject;当该方法为类方法(即静态方法) 时该参数为jclass,指向该类的class。 根据不同方法前缀生成的头文件比较如下: 1、static与非static的比较: /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doInt *Signature:(DD)I */ JNIEXPORTjintJNICALLJava_com_nedu_jni_helloword_HeaderFile_doInt__DD (JNIEnv*,<spanstyle="background-co lor:rgb(255,0,0);">jobject</span>,jdouble,jdouble); /* *Class:com_nedu_jni_helloword_HeaderFile *Method:doInt *Signature:(DDD)I */ JNIEXPORTjintJNICALLJava_com_nedu_jni_helloword_HeaderFile_doInt__DDD (JNIEnv*,<spanstyle="color:#000000;background-color:rgb(255,0,0);">jclass</span>,jdouble,jdouble,jdouble); 第一个是非static方法,第二个是static方法,不同点如上红色标记。其中的不同将在以后提到。 2、private、friendly、protected以及public这些方法限制符不会在JNI的头文件中出现。这些访问修饰符只有在其它类 使用这些方法时有效!JNI中不关心此修饰符! /** *@author张兴业 *邮箱:xy-zhang@163.com *qq:363302850 */ 本文转自xyz_lmn51CTO博客,原文链接:http://blog.51cto.com/xyzlmn/817213 ,如需转载请自行联系原作者

优秀的个人博客,低调大师

Android GIS开发系列-- 入门季(10) MapView快速定位到Geometry

我们知道某个Geometry的坐标,但不知道具体的位置,该如何使地图快速定位呢?这时需要用到MapView.setExtent方法,来看下这个方法的介绍:Zooms the map to the given geometry so that geometry fits within the bounds of the map.大体的意思即缩小地图定位到Geometry。上代码: public class MainActivity extends Activity { private MapView mapView; private GraphicsLayer graphicsLayer; private static final String TILED_WORLD_STREETS_URL = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mapView = (MapView) findViewById(R.id.map_view); mapView.addLayer(new ArcGISTiledMapServiceLayer(TILED_WORLD_STREETS_URL)); findViewById(R.id.location).setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { //快速定位到线 Polyline polyline = new Polyline(); polyline.startPath(new Point(110, 23)); polyline.lineTo(new Point(115, 25)); //由于加载的地图是墨卡托坐标,这里需要转坐标 Polyline polyline2 = (Polyline) GeometryEngine.project(polyline, SpatialReference.create(SpatialReference.WKID_WGS84), SpatialReference .create(SpatialReference.WKID_WGS84_WEB_MERCATOR)); mapView.setExtent(polyline2); } }); initLayer(); } /** * 添加一条线 */ private void initLayer() { graphicsLayer = new GraphicsLayer(); mapView.addLayer(graphicsLayer); Polyline polyline = new Polyline(); polyline.startPath(new Point(110, 23)); polyline.lineTo(new Point(115, 25)); //由于加载的地图是墨卡托坐标,这里需要转坐标 Polyline polyline2 = (Polyline) GeometryEngine.project(polyline, SpatialReference.create(SpatialReference.WKID_WGS84), SpatialReference .create(SpatialReference.WKID_WGS84_WEB_MERCATOR)); graphicsLayer.addGraphic(new Graphic(polyline2, new SimpleLineSymbol( Color.RED, 3, SimpleLineSymbol.STYLE.SOLID))); } } 没有整理与归纳的知识,一文不值!高度概括与梳理的知识,才是自己真正的知识与技能。 永远不要让自己的自由、好奇、充满创造力的想法被现实的框架所束缚,让创造力自由成长吧! 多花时间,关心他(她)人,正如别人所关心你的。理想的腾飞与实现,没有别人的支持与帮助,是万万不能的。 本文转自wenglabs博客园博客,原文链接:http://www.cnblogs.com/arxive/p/7751971.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

轻量应用服务器 快速入门:使用流程

使用流程 购买(创建实例) 以 WordPress 为例。 1.登录 阿里云官网,打开轻量应用服务器购买页面。按照提示选择镜像、地域、套餐,时长,单击 购买。 2.在 确认订单 页面,确认订单信息。核对无误后,单击 去支付。 3.支付成功后,单击 跳转到控制台。 获取应用初始化信息 1.登录轻量应用服务器控制台,在 服务器列表 中找到之前购买的服务器,单击 详情。 2.进入 WordPress 的 应用详情 页面,查看相关应用初始化安装信息详情。 设置应用 应用已经安装完毕。根据上一步看到的应用信息,我们需要获得已经安装好的 WordPress 的管理员账号和账号密码。 1.在 WordPress 的 应用详情 页面,单击右上角的 远程连接。 2.根据上一章得到的应用安装信息,我们知道应用的管理账号和账号密码在服务器 /root/env.txt 路径下。在远程连接窗口中输入以下内容: sudo cat /root/env.txt 即可获得 WordPress 的管理员账号和账号密码。 3.复制管理员账号密码。 4.打开应用安装信息的管理员登录页面,WordPress 的后台地址一般为 http://ip地址/wp-login.php 。 5.输入账号 admin,并粘贴之前复制好的密码,单击 登录。 6.登录成功后,您可以根据自身需要配置 WordPress。 为方便用户后续操作,可以更新个人资料,步骤如下: 1.单击 admin 下面的 编辑 按钮。 2.进入 用户 页面,在 账户管理 部分,单击 生成密码,按照提示输入密码。 3.然后输入邮件地址,并单击 更新个人资料。 绑定域名、解析域名 1.打开控制台,单击左侧导航栏的 站点设置 > 域名 > 添加域名。如果已经有在阿里云注册或者使用阿里云解析的域名,可以直接解析。 2.输入域名,单击 确定。 测试访问 修改 WordPress 后台的地址为绑定的域名,通过域名测试访问应用。 注意:修改前务必保证绑定域名已经解析成功,否则会出现后台无法登录的情况。

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册
修改密码
忘记密码