内容教程分析guide_第1页
内容教程分析guide_第2页
内容教程分析guide_第3页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、MyCAT ThesofMyCATrunsonwhichserveralsorunss.HereMyCAT ThesofMyCATrunsonwhichserveralsorunss.HerewetheinstallationsofMyCATisimplementedinJDK1.7,soJRE1.7orlatermustbeforrunningYoucoulddownloadandinstallJDKorJREfromtheURLGetthenewestofMyCATttolocateallfilesonthe/usr/local/MyCAT,withoutanycharacterindir

2、ectorynames,liketheThefollowingisthewaytomodifyMyCatuserspassword(forFollowing subdirectories below MyCAT are with the meanings as Directory named bin, stores scriptsfilesforLinuxandbatfilesforWindows.Allthe s,andnowrappedones.YoucanchooseyourwaytoDirectory named bin, stores scriptsfilesforLinuxandb

3、atfilesforWindows.Allthe s,andnowrappedones.Youcanchooseyourwaytouse,modifythemasyourInWindows,runmycat.batincmdwindow.Youcanconfigittobeawindowsservice. confirmdisdsasod+xnohup sh mycat console hewrapmode,itcanbeinstalledasaservicetobestartedandmycat install mycat Directory named conf, stores confi

4、guration files. XML server.xml contains configurations runningand authorizing MyCATserver arguments. XMLschema.xmlcontains configurationsfor logicdatabase,tabledefinationsandshardingdefinations.XMLrule.xmlcontainsshardingrules,andargumentsofshardingrulesarestoredasotherhisdirectorytoo.XMLcontainscon

5、figurationsforlog,andyoucanmodifyitasyourt,thewrapmodeprocedure,whoseJVMargumentsareconf/wrap.conf.Youcanmodifyitasyoure.The./doc/english/properties.html is reference to ThereisaninstanceofwrapmodeNOTE:MyCATrequiresJDK1.7.ItwouldthrowsomeexceptionswithJDK1.6.Youspecifiytheabsolutepathofheconfigurati

6、onfileTHE FOLLOWING ARE SOME CONFIGRATIONS IN #JavaAdditionalwrapper.java.additional.5=-#InitialJavaHeapSize#umJavaHeapSizeIftherearenotenoughRAMstostartup,youcouldtrytospecifyall#umJavaHeapSizeIftherearenotenoughRAMstostartup,youcouldtrytospecifyallmemoryparamssuch1GorLogfileisstoredinog,onelogfile

7、perday.Itcouldoutputmoreinfo,runningdebuglevel,inordertoYoucanrunserveronthesamemachinewhichisrunningaMyCATinQUICK,andensureitcouldbelogedinandexecutedCRUDConnect CREATE database CREATE database CREATE database NOTE:ifisforLinux,lettercaseinsensitiveisrequired,otherwise,tablecannotfoundbyMyCATprobab

8、ly.Theconfigisaslower_case_table_names=To modify database connection should compliance with connection 修改完成后保存,进入到 功以后显示如下信息下,执行启动命令:startup.bat ,启动To save all modified configuration files, switch directory to MYCAT_HOME/bin, startup.batinwindowsormycatstartindT,defaultportfordatais8066,andportforTo

9、 save all modified configuration files, switch directory to MYCAT_HOME/bin, startup.batinwindowsormycatstartindT,defaultportfordatais8066,andportformanagementisYousouseGUIchworkbench, navicat, and some other database implementsinjava.Tospecifyportas8066,anddatabasenameasdfollowingdline,youcansutest

10、ptest h P8066 Allsqlwillbebechangedtodlinents.IfJDBCistobeused,theport theusernameandpasswordconnectedbyMyCATarestoredinTheyarethetwoindepencysystems,andlogicaldatabases(schemas)andlogicaltablesMyCATwithrespecttodatabaseandySQLareFOLLOWINGISASIMPLETable employee, is sharded according to the rule of

11、sharding-by-infile, whose sharding field Createtableemployeebyfollowingcreate table employee not null primary key,name notexplain create table employee not null primary key,name Itat,checkdefinitionofemployeeinschema.xmlanditsshardingrule,and twhichdatawillbeindn1,andwhichwillbein温馨提示:explain 可Itat,

12、checkdefinitionofemployeeinschema.xmlanditsshardingrule,and twhichdatawillbeindn1,andwhichwillbein温馨提示:explain 可以用于任何正确的SQL 上,其作用是告诉你,这条SQL 会路由些分片节点上执行,这对分片相很有帮助。另外,explain 可以安全的行多次,它仅仅是告诉你 SQL 的路由分片,而不会执行该 SQLdexplaincouldbeusedforcorrectSQL,lyouwhichnodethesqlwillroutedtoexecute.Itisuseful todiagn

13、oseproblemsaboutsharding.d couldbesafelyexecutedmultipletimes, lsyoutheshardingrouteesofSQL,butINSERTo employee(id,name,sharding_id) values(1,leader Table company is sharded according to auto-sharding-long y following createtablenot null primary key,name INSERTo company(id,name) o company(id,name) Y

14、ouwillseethethreerecordsaboveareglobal table. Execute oconfirmexplain o company(id,name) |+|o company(id,name) values(1,hp) |o company(id,name) values(1,hp) |o company(id,name) values(1,hp) +Createtablecreatecustomer: createtablenotnullprimary|+|o company(id,name) values(1,hp) |o company(id,name) va

15、lues(1,hp) |o company(id,name) values(1,hp) +Createtablecreatecustomer: createtablenotnullprimarynot not INSERTinocustomerpany_id,sharding_id inocustomerpany_id,sharding_id ino customer pany_id,sharding_id )values(3,feng,3,10000); EXECUTESelect*from explainSelect*from customer; #CONFIRMDATASARESTORE

16、DBYCreatetableorders,andinsertcreatetableordersvarchar(100) notnullprimarykeynoto orders(id,customer_id) values(1,1); /stored in db1 because customer table id=1storedino orders(id,customer_id) values(2,2); /stored in db2 because customer table id=1storedinexplain o orders(id,customer_id) select ,ord

17、ers.* from customer ,orders Createtabletravelrecordandinsertsravelrecordisexplain o orders(id,customer_id) select ,orders.* from customer ,orders Createtabletravelrecordandinsertsravelrecordisstoredbyshardingruleofidcreate travelrecord: create table travelrecord (id o travelrecord (id,user_id,traveldate,fee,days) values(1,wang,2014-05,510.5,3);#this id is stored in node explain o travelrecord values(7000001,wang,2014-05,510.5,3);#thisidisstoredinnodeTOEXECUTEACROSS-SHARDING create table not null primary key ,title varchar(400) ,

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论