Hadoop之Hbase建表(详细步骤) |
您所在的位置:网站首页 › 查看hbase表大小 › Hadoop之Hbase建表(详细步骤) |
1、启动HDFS和HBase cd /home/ZQ/hadoop-2.7.6/sbin start-dfs.sh cd /home/ZQ/hbase-1.4.13/bin/ start-hbase.sh2、进入hbase shell cd hbase shell3、创建表 create 'StudentAndCourse','student','course1','course2','course3'4、插入数据 ①新增学号为2015001的学生的所有信息 put 'StudentAndCourse','2015001','student:S_Name','Zhangsan' put 'StudentAndCourse','2015001','student:S_Sex','male' put 'StudentAndCourse','2015001','student:S_Age','23' put 'StudentAndCourse','2015001','course1:C_No','123001' put 'StudentAndCourse','2015001','course1:C_Name','Math' put 'StudentAndCourse','2015001','course1:C_Credit','2.0' put 'StudentAndCourse','2015001','course1:Score','86' put 'StudentAndCourse' ,'2015001','course3:C_No','123003' put 'StudentAndCourse' ,'2015001','course3:C_Name','English' put 'StudentAndCourse' ,'2015001','course3:C_Credit','3.0' put 'StudentAndCourse' ,'2015001','course3:Score','69'②、新增学号为2015002的学生的所有信息 put 'StudentAndCourse' ,'2015002','student:S_Name','Mary' put 'StudentAndCourse' ,'2015002','student:S_Sex','female' put 'StudentAndCourse' ,'2015002','student:S_Age','22' put 'StudentAndCourse' ,'2015002','course2:C_No','123002' put 'StudentAndCourse' ,'2015002','course2:C_Name','Conputer Science' put 'StudentAndCourse' ,'2015002','course2:Credit','5.0' put "StudentAndCourse" ,'2015002','course2:Score','77' put 'StudentAndCourse' ,'2015002','course3:C_No','123003' put 'StudentAndCourse' ,'2015002','course3:C_Name','English' put 'StudentAndCourse' ,'2015002','course3:Credit','3.0' put 'StudentAndCourse' ,'2015002','course3:Score','99'③、新增学号为2015003的学生的所有信息 put 'StudentAndCourse' ,'2015003','student:S_Name','Lisi' put 'StudentAndCourse' ,'2015003','student:S_Sex','male' put 'StudentAndCourse' ,'2015003','student:S_Age','24' put 'StudentAndCourse' ,'2015003','course1:C_No','123001' put 'StudentAndCourse' ,'2015003','course1:C_Name','Math' put 'StudentAndCourse' ,'2015003','course1:C_Credit','2.0' put 'StudentAndCourse' ,'2015003','course1:Score','98' put 'StudentAndCourse' ,'2015003','course2:C_No','123002' put 'StudentAndCourse' ,'2015003','course2:C_Name','Computer Science' put 'StudentAndCourse' ,'2015003','course2:C_Credit','5.0' put 'StudentAndCourse' ,'2015003','course2:Score','95'5、查看表的数据 scan 'StudentAndCourse'6、查看web界面 在浏览器中输入10.103.105.62:60010(主节点)进行查看
退出hbase shell exit7、停止hbase和HDFS cd /home/ZQ/hbase-1.4.13/bin/ stop-hbase.sh cd /home/ZQ/hadoop-2.7.6/sbin stop-dfs.sh |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |