HBase是Hadoop的数据库,基于Hadoop运行,是一种NoSQL数据库。 特点:分布式、多版本、面向列的存储模型,能够大规模的数据实时随机读写,可直接使用本地文件系统。 不适合:与关系型数据库相比,模型简单,API很少;不适合小规模的数据。 数据存放的位置叫
HBase是Hadoop的数据库,基于Hadoop运行,是一种NoSQL数据库。
特点:分布式、多版本、面向列的存储模型,能够大规模的数据实时随机读写,可直接使用本地文件系统。
不适合:与关系型数据库相比,模型简单,API很少;不适合小规模的数据。
数据存放的位置叫做单元(cell),其中的数据可以有多个版本,根据时间戳(timestamp)来区别。
安装:
tar xfz hbase-0.94.18.tar.gz
cd hbase*
cd conf
vi hbase-env.sh
export JAVA_HOME = /usr/jdk1.6.0_45
vi hbase-site.xml
<configuration> <property> <name>hbase.rootdir</name> <value>hdfs://localhost:9000/hbase</value> <description>数据存放的位置。</description> </property> <property> <name>dfs.replication</name> <value>1</value> <description>指定副本个数为1,因为伪分布式。</description> </property> </configuration>以上配置完成后,启动hadoop,
cd ../hadoop
bin/start-all.sh
jps 检查是否启动成功。
然后启动hbase,
cd ../hbase*
bin/start-hbase.sh
jps检查hbase是否启动成功,
成功会有HMaster
也可通过浏览器,http://localhost:60010查看
bin/hbase shell 可进入hbase命令行工具。
HBase Shell 支持多种命令
–一般的有
? status, version
–数据定义语言(DDL)
? alter, create, describe, disable, drop, enable, exists, is_disabled,
is_enabled, list
–数据控制语言 (DML)
? count, delete, deleteall, get, get_counter, incr, put, scan, truncate
–集群管理
? balancer, close_region, compact, flush, major_compact, move, split,
unassign, zk_dump, add_peer,disable_peer, enable_peer,
remove_peer, start_replication, stop_replication
? 查看每个命令的使用方法
–hbase> help "
>list #列出hbase存在的表
>status #返回集群的状态信息
创建一张表,hbase有多种建表的方式:
--hbase> create 't1', {NAME => 'f1', VERSIONS => 5}
–hbase> create 't1', {NAME => 'f1', VERSIONS => 1,
TTL => 2592000, BLOCKCACHE => true}
–hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'},
{NAME => 'f3'}
–hbase> create 't1', 'f1', 'f2', 'f3'
如,create 'blog', {NAME=>'info'}, {NAME=>'content'}
list查看hbase中的表
建好表之后,添加数据到表中
格式如下:
put 'table', 'row_id', 'family:column', 'value'
put 'Blog', 'Matt-001', 'info:title', 'Elephant'
put 'Blog', 'Matt-001', 'info:author', 'Matt'
put 'Blog', 'Matt-001', 'info:date', '2014.04.26'
count 'table_name' 查看列数
get 'table', 'row_id' 获取表中的某一列数据
scan 'table_name' 返回整张表的全部数据
scan 'table', {COLUMNS=>['col1', 'col2']} 也可以加条件
编辑数据:
用的还是put 命令,即put在列不存在的时候执行添加,存在的话就执行修改。
修改的时候会保留之前的版本,默认会保留3份。
delete 'table', 'rowId', 'column' 删除数据,不加条件会删除所有版本。
删除表,首先要将表的状态改成离线,disable 'table_name'
才能删除,drop 'table_name'

mysqlviewshavelimitations:1)他们不使用Supportallsqloperations,限制DatamanipulationThroughViewSwithJoinSorsubqueries.2)他们canimpactperformance,尤其是withcomplexcomplexclexeriesorlargedatasets.3)

porthusermanagementInmysqliscialforenhancingsEcurityAndsingsmenting效率databaseoperation.1)usecReateusertoAddusers,指定connectionsourcewith@'localhost'or@'%'。

mysqldoes notimposeahardlimitontriggers,butacticalfactorsdeterminetheireffactective:1)serverConfiguration impactactStriggerGermanagement; 2)复杂的TriggerSincreaseSySystemsystem load; 3)largertablesslowtriggerperfermance; 4)highConconcConcrencerCancancancancanceTigrignecentign; 5); 5)

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

通过PHP网页界面添加MySQL用户可以使用MySQLi扩展。步骤如下:1.连接MySQL数据库,使用MySQLi扩展。2.创建用户,使用CREATEUSER语句,并使用PASSWORD()函数加密密码。3.防止SQL注入,使用mysqli_real_escape_string()函数处理用户输入。4.为新用户分配权限,使用GRANT语句。

mysql'sblobissuitableForStoringBinaryDataWithInareLationalDatabase,而alenosqloptionslikemongodb,redis和calablesolutionsoluntionsoluntionsoluntionsolundortionsolunsolunsstructureddata.blobobobsimplobissimplobisslowderperformandperformanceperformancewithlararengelitiate;

toaddauserinmysql,使用:createUser'username'@'host'Indessify'password'; there'showtodoitsecurely:1)choosethehostcarecarefullytocon trolaccess.2)setResourcelimitswithoptionslikemax_queries_per_hour.3)usestrong,iniquepasswords.4)Enforcessl/tlsconnectionswith

toAvoidCommonMistakeswithStringDatatatPesInMysQl,CloseStringTypenuances,chosethirtightType,andManageEngencodingAndCollationsEttingsefectery.1)usecharforfixed lengengters lengengtings,varchar forbariaible lengength,varchariable length,andtext/blobforlabforlargerdata.2 seterters seterters seterters seterters


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

适用于 Eclipse 的 SAP NetWeaver 服务器适配器
将Eclipse与SAP NetWeaver应用服务器集成。

MinGW - 适用于 Windows 的极简 GNU
这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

禅工作室 13.0.1
功能强大的PHP集成开发环境

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境

mPDF
mPDF是一个PHP库,可以从UTF-8编码的HTML生成PDF文件。原作者Ian Back编写mPDF以从他的网站上“即时”输出PDF文件,并处理不同的语言。与原始脚本如HTML2FPDF相比,它的速度较慢,并且在使用Unicode字体时生成的文件较大,但支持CSS样式等,并进行了大量增强。支持几乎所有语言,包括RTL(阿拉伯语和希伯来语)和CJK(中日韩)。支持嵌套的块级元素(如P、DIV),