ignite從0到1的學習過程記錄-第一篇:安裝和體驗


1、學習背景

  之前做一個根據wifi點位實時計算個人的軌跡的應用,使用Hbase, 盡管做了些優化,但是在計算性能上仍然不能滿足需求,當時考慮是否可以用分布內存計算框架來解決,不過項目后來由於數據來源問題擱置也就沒再繼續,但是ignite進入視野,我想這么牛的東西一定得學學^_^。

 

2、學習資源

  中文有這位大神翻譯的文檔,中文文檔

  英文學習資源當屬官網:英文文檔

3、簡單介紹

  參考官網基礎概念介紹,ignite 至少有以下特性

  • 支持sql 和k-v 兩種模式
  • 既可以作為應用二級緩存使用又可以作為一個內存數據庫
  • 分布式支持非常好,具體怎么好,以后慢慢探究
  • 擁有並行計算的能力,不用客戶端抓取大量數據再進行計算(好像可以理解成iginte也可以作為一個並行計算框架)

 4、安裝ignite

  初步學習自然要安裝一個試一試,Getting-started

       這里記錄下根據文檔學習的過程,首先下載編譯的好的最新安裝包,使用命令行啟動。

  • 打開目錄 
    $ cd /d/apache-ignite-fabric-2.3.0-bin/
  • 查看環境變量
    $ echo $JAVA_HOME
    C:\Program Files\Java\jdk1.8.0_151
  • 運行
    $ cd bin
    $ sh ignite.sh
    [17:03:52]    __________  ________________
    [17:03:52]   /  _/ ___/ |/ /  _/_  __/ __/
    [17:03:52]  _/ // (7 7    // /  / / / _/
    [17:03:52] /___/\___/_/|_/___/ /_/ /___/
    [17:03:52]
    [17:03:52] ver. 2.3.0#20171028-sha1:8add7fd5
    [17:03:52] 2017 Copyright(C) Apache Software Foundation
    [17:03:52]
    [17:03:52] Ignite documentation: http://ignite.apache.org
    [17:03:52]
    [17:03:52] Quiet mode.
    [17:03:52]   ^-- Logging to file 'd:\apache-ignite-fabric-2.3.0-bin\work\log\ignite-a4954706.0.log'
    [17:03:52]   ^-- To see **FULL** console log here add -DIGNITE_QUIET=false or "-v" to ignite.{sh|bat}
    [17:03:52]
    [17:03:52] OS: Windows 10 10.0 amd64
    [17:03:52] VM information: Java(TM) SE Runtime Environment 1.8.0_151-b12 Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 25.151-b12
    [17:03:52] Configured plugins:
    [17:03:52]   ^-- None
    [17:03:52]
    [17:03:52] Message queue limit is set to 0 which may lead to potential OOMEs when running cache operations in FULL_ASYNC or PRIMARY_SYNC modes due to message queues growth on sender and receiver sides.
    [17:03:52] Security status [authentication=off, tls/ssl=off]
    [17:03:55] Performance suggestions for grid  (fix if possible)
    [17:03:55] To disable, set -DIGNITE_PERFORMANCE_SUGGESTIONS_DISABLED=true
    [17:03:55]   ^-- Enable G1 Garbage Collector (add '-XX:+UseG1GC' to JVM options)
    [17:03:55]   ^-- Set max direct memory size if getting 'OOME: Direct buffer memory' (add '-XX:MaxDirectMemorySize=<size>[g|G|m|M|k|K]' to JVM options)
    [17:03:55]   ^-- Disable processing of calls to System.gc() (add '-XX:+DisableExplicitGC' to JVM options)
    [17:03:55] Refer to this page for more performance suggestions: https://apacheignite.readme.io/docs/jvm-and-system-tuning
    [17:03:55]
    [17:03:55] To start Console Management & Monitoring run ignitevisorcmd.{sh|bat}
    [17:03:55]
    [17:03:55] Ignite node started OK (id=a4954706)
    [17:03:55] Topology snapshot [ver=1, servers=1, clients=0, CPUs=4, heap=1.0GB]
    在 sh ignite.sh 命令后可以指定配置文件 或者添加-i參數來選擇配置文件。

 5、工具使用

  5.1 管理和監控工具

  在Getting-started 末尾提到了兩個工具,原文如下:

  The easiest way to examine the content of the data grid as well as perform other management and monitoring operations is to use the Ignite Web Console and Ignite Visor Command Line utility.

  這兩個工具都是用來管理和監控ignite的,在上一步的啟動腳本打印的信息末尾可以看到這樣一句

  

說明在ignite編譯時,已經將visor command line 一起編譯了,找到bin目錄啟動該腳本

  • 啟動腳本
    $ sh ignitevisorcmd.sh
    ___    _________________________ ________
    __ |  / /____  _/__  ___/__  __ \___  __ \
    __ | / /  __  /  _____ \ _  / / /__  /_/ /
    __ |/ /  __/ /   ____/ / / /_/ / _  _, _/
    _____/   /___/   /____/  \____/  /_/ |_|
    
    ADMIN CONSOLE
    2017 Copyright(C) Apache Software Foundation
    
    +-------------------------------------+
    | Status               | Disconnected |
    | Ignite instance name | <n/a>        |
    | Config path          | <n/a>        |
    | Uptime               | <n/a>        |
    +-------------------------------------+
    
    Type 'help' for more information.
    Type 'open' to join the grid.
    Type 'quit' to quit form Visor console.
    
    visor>

    根據 cmd 說明,通過open命令啟動一個ignite節點 ,具體命令的作用以后再慢慢學習。

  5.2 sqlline工具

  使用參考 sqlline說明

  • 啟動sqlline
    sqlline.bat --color=true --verbose=true -u jdbc:ignite:thin://127.0.0.1/   # linux ./sqlline.sh ...

     

  • 執行腳本 用!sql +sql 語句即可
    !sql create table city (id LONG primary key, name varchar);
    !sql insert into city (id, name) values(1, 'Forest Hill');
    !sql select * from city;

   ignite作為內存數據庫,重啟ignite后,再執行select * from city 拋出異常,因為之前的數據已經不在了。

  5.3 使用DBeaver連接ignite

  ignite支持sql模式,自然可以用sql客戶端連接,官網給出了使用DBeaver連接ignite的說明 SQL Tooling

  只需要在DBeaver 驅動管理中新增ignite驅動即可使用,下面我的配置截圖

  • 配置驅動

     

  • 添加鏈接

     

  完成之后和操作其他數據庫基本一樣了。

  6、web-console

  在5.1中有提到web-console, 這是個比較強大的管理和監控工具,Ignite Web Console,我這里直接拉取docker鏡像,

  •  拉取鏡像
    docker pull registry.docker-cn.com/apacheignite/web-console-standalone

     

  • 運行docker
    docker run -d -p 80:80 -v /mongo:/var/lib/mongodb --name web-console-standalone apacheignite/web-console-standalone

    直接瀏覽器屬於ip即可訪問

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM