<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          data-generator標(biāo)準(zhǔn)數(shù)據(jù)生成器

          聯(lián)合創(chuàng)作 · 2023-10-01 20:04

          數(shù)據(jù)生成器

          如果你在從事大數(shù)據(jù)BI的工作,想對(duì)比一下MySQL、GreenPlum、Elasticsearch、Hive、Presto、Impala、Drill、HAWQ、Druid、Pinot、Kylin、ClickHouse等不同實(shí)現(xiàn)方案之間的表現(xiàn),那你就需要一份標(biāo)準(zhǔn)的數(shù)據(jù)進(jìn)行測(cè)試,這個(gè)開(kāi)源項(xiàng)目就是為了生成這樣的標(biāo)準(zhǔn)數(shù)據(jù)。

          數(shù)據(jù)模型:src/main/resources/數(shù)據(jù)模型.png

          一、編譯程序:

           mvn assembly:assembly

          二、在MySQL中創(chuàng)建一個(gè)數(shù)據(jù)庫(kù),然后執(zhí)行 src/main/resources/model_ddl.sql 創(chuàng)建對(duì)應(yīng)的表。

          三、指定ES的經(jīng)緯度類(lèi)型:

          curl -H "Content-Type: application/json" -XPUT 'http://192.168.252.193:9200/contract/contract/_bulk' -d '
          { "index":{ "_id": 1} }
          {"id":1}
          '
          
          curl -H "Content-Type: application/json" -XPUT 'http://192.168.252.193:9200/contract/_mapping/contract' -d '
          {
            "properties": {
              "geo_location": {
                "type": "geo_point"
              }
            }
          }
          '
          
          curl -H "Content-Type: application/json" -XPUT 'http://192.168.252.193:9200/detail/detail/_bulk' -d '
          { "index":{ "_id": 1} }
          {"id":1}
          '
          
          curl -H "Content-Type: application/json" -XPUT 'http://192.168.252.193:9200/detail/_mapping/detail' -d '
          {
            "properties": {
              "geo_location": {
                "type": "geo_point"
              }
            }
          }
          '
          
          curl -H "Content-Type: application/json" -XPUT 'http://192.168.252.193:9200/area/area/_bulk' -d '
          { "index":{ "_id": 1} }
          {"id":1}
          '
          
          curl -H "Content-Type: application/json" -XPUT 'http://192.168.252.193:9200/area/_mapping/area' -d '
          {
            "properties": {
              "geo_location": {
                "type": "geo_point"
              }
            }
          }
          '
          
          curl -H "Content-Type: application/json" -XPUT 'http://192.168.252.193:9200/customer/customer/_bulk' -d '
          { "index":{ "_id": 1} }
          {"id":1}
          '
          
          curl -H "Content-Type: application/json" -XPUT 'http://192.168.252.193:9200/customer/_mapping/customer' -d '
          {
            "properties": {
              "geo_location": {
                "type": "geo_point"
              }
            }
          }
          '
          
          curl -H "Content-Type: application/json" -XPUT 'http://192.168.252.193:9200/sales_staff/sales_staff/_bulk' -d '
          { "index":{ "_id": 1} }
          {"id":1}
          '
          
          curl -H "Content-Type: application/json" -XPUT 'http://192.168.252.193:9200/sales_staff/_mapping/sales_staff' -d '
          {
            "properties": {
              "geo_location": {
                "type": "geo_point"
              }
            }
          }
          '

          四、在當(dāng)前目錄下的config.txt文件中指定配置:

          #新增數(shù)據(jù)是MySQL批量提交記錄數(shù)量
          batchSize=1000
          #訂單時(shí)間開(kāi)始年份
          startYear=2000
          #訂單時(shí)間開(kāi)始月份
          startMonth=1
          #訂單時(shí)間開(kāi)始天數(shù)
          startDay=1
          #客戶(hù)數(shù)
          customerCount=5000
          #銷(xiāo)售數(shù)
          salesStaffCount=2000
          #合同數(shù)
          contractCount=20000
          #商品數(shù)
          itemCount=10000
          #商品價(jià)格上限
          priceLimit=1000
          #合同最大明細(xì)數(shù)
          contractDetailLimit=100
          #合同明細(xì)商品最大數(shù)量
          itemQuantityLimit=100
          #將生成的數(shù)據(jù)保存到哪個(gè)MySQL
          mysql.url=jdbc:mysql://192.168.252.193:3306/demo?useUnicode=true&characterEncoding=utf8
          mysql.user=root
          mysql.password=root
          mysql.pageSize=10000
          #將MySQL里面的數(shù)據(jù)查出來(lái)組裝成JSON文檔后索引到哪個(gè)ES
          es.host=192.168.252.193
          es.port=9200
          #ES批量提交數(shù)量
          es.batchSize=1000
          #可選值為file或者es
          #如果選擇file,則在當(dāng)前目錄想生成相應(yīng)的腳本文件,等程序執(zhí)行完畢后再執(zhí)行腳本文件將數(shù)據(jù)索引到ES
          #如果選擇es,則在數(shù)據(jù)生成完畢后直接在程序中把數(shù)據(jù)提交給ES進(jìn)行索引
          es.mode=es
          #是否異步多線程的方式進(jìn)行ES索引
          output.async=true
          #如果是異步多線程的方式進(jìn)行ES索引,則需要幾個(gè)線程
          output.async.thread.count=10
          #如果ES索引中斷,再次索引的時(shí)候從哪一頁(yè)開(kāi)始索引,0代表第一頁(yè)
          output.start.page=0

          五、運(yùn)行程序:

          all in one:

          nohup java -Xmx2g -Xms2g -cp data-generator-1.0-jar-with-dependencies.jar org.apdplat.data.generator.Start &

          或者

          step by step:

          1. 生成模擬數(shù)據(jù)并保存到mysql:
          
              nohup java -Xmx2g -Xms2g -cp data-generator-1.0-jar-with-dependencies.jar org.apdplat.data.generator.generator.Generator &
          
          2. 將mysql中的數(shù)據(jù)生成合同文檔并提交給ES:
          
              nohup java -Xmx2g -Xms2g -cp data-generator-1.0-jar-with-dependencies.jar org.apdplat.data.generator.mysql2es.Contract &
              如果es.mode=es則不需要執(zhí)行如下兩步, 只有es.mode=file才需要執(zhí)行
              chmod +x contract.sh
              nohup ./contract.sh &
          
          3. 將mysql中的數(shù)據(jù)生成合同明細(xì)文檔并提交給ES:
          
              nohup java -Xmx2g -Xms2g -cp data-generator-1.0-jar-with-dependencies.jar org.apdplat.data.generator.mysql2es.ContractDetail &
              如果es.mode=es則不需要執(zhí)行如下兩步, 只有es.mode=file才需要執(zhí)行
              chmod +x detail.sh
              nohup ./detail.sh &
          
          4. 將mysql中的數(shù)據(jù)生成區(qū)域文檔并提交給ES:
          
              nohup java -Xmx1g -Xms1g -cp data-generator-1.0-jar-with-dependencies.jar org.apdplat.data.generator.mysql2es.Area &
              如果es.mode=es則不需要執(zhí)行如下兩步, 只有es.mode=file才需要執(zhí)行
              chmod +x area.sh
              nohup ./area.sh &
          
          5. 將mysql中的數(shù)據(jù)生成商品文檔并提交給ES:
          
              nohup java -Xmx2g -Xms2g -cp data-generator-1.0-jar-with-dependencies.jar org.apdplat.data.generator.mysql2es.Item &
              如果es.mode=es則不需要執(zhí)行如下兩步, 只有es.mode=file才需要執(zhí)行
              chmod +x item.sh
              nohup ./item.sh &
          
          6. 將mysql中的數(shù)據(jù)生成客戶(hù)文檔并提交給ES:
          
              nohup java -Xmx2g -Xms2g -cp data-generator-1.0-jar-with-dependencies.jar org.apdplat.data.generator.mysql2es.Customer &
              如果es.mode=es則不需要執(zhí)行如下兩步, 只有es.mode=file才需要執(zhí)行
              chmod +x customer.sh
              nohup ./customer.sh &
          
          7. 將mysql中的數(shù)據(jù)生成銷(xiāo)售文檔并提交給ES:
          
              nohup java -Xmx2g -Xms2g -cp data-generator-1.0-jar-with-dependencies.jar org.apdplat.data.generator.mysql2es.SalesStaff &
              如果es.mode=es則不需要執(zhí)行如下兩步, 只有es.mode=file才需要執(zhí)行
              chmod +x sales_staff.sh
              nohup ./sales_staff.sh &
          
          8. 將mysql中的數(shù)據(jù)生成品牌文檔并提交給ES:
          
              nohup java -Xmx2g -Xms2g -cp data-generator-1.0-jar-with-dependencies.jar org.apdplat.data.generator.mysql2es.Brand &
              如果es.mode=es則不需要執(zhí)行如下兩步, 只有es.mode=file才需要執(zhí)行
              chmod +x brand.sh
              nohup ./brand.sh &
          
          9. 將mysql中的數(shù)據(jù)生成分類(lèi)文檔并提交給ES:
          
              nohup java -Xmx2g -Xms2g -cp data-generator-1.0-jar-with-dependencies.jar org.apdplat.data.generator.mysql2es.Category &
              如果es.mode=es則不需要執(zhí)行如下兩步, 只有es.mode=file才需要執(zhí)行
              chmod +x category.sh
              nohup ./category.sh &

          六、在hive中執(zhí)行 src/main/resources/hive_ddl.sql 創(chuàng)建表。

          七、執(zhí)行 src/main/resources/sqoop.txt 中的命令將MySQL中的數(shù)據(jù)導(dǎo)入Hive。

          八、在Kylin中導(dǎo)入Hive的表、創(chuàng)建Model和Cube、構(gòu)建Cube。

          九、在Kibana中創(chuàng)建索引模式,創(chuàng)建圖表。

          十、對(duì)MySQL、Kibana+ES、Kylin進(jìn)行對(duì)比如下統(tǒng)計(jì):

          SELECT
              item. NAME ,
              sum(contract_detail.price) AS total_price ,
              sum(contract_detail.item_quantity) AS total_quantity
          FROM
              contract_detail
          LEFT JOIN item ON contract_detail.item_id = item.id
          GROUP BY
              item. NAME
          ORDER BY
              total_quantity DESC 
              
          Kylin耗時(shí)0.5秒,MySQL59秒,ES5秒。
          瀏覽 12
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  麻豆成人毛片 | 无码人妻一区二区三区精品不付款 | 国产偷抇久久精品A片69探花 | 无码视频免费在线播放 | 青娱乐在线免费 |