influxdb 的安裝(centos)


安裝命令:

# for 64-bit systems
wget http://s3.amazonaws.com/influxdb/influxdb-latest-1.x86_64.rpm
sudo rpm -ivh influxdb-latest-1.x86_64.rpm

具體安裝過程如下:

wget http://s3.amazonaws.com/influxdb/influxdb-latest-1.x86_64.rpm
--2014-11-10 00:03:38--  http://s3.amazonaws.com/influxdb/influxdb-latest-1.x86_64.rpm
Resolving s3.amazonaws.com... 54.231.10.248
Connecting to s3.amazonaws.com|54.231.10.248|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16227107 (15M) [binary/octet-stream]
Saving to: “influxdb-latest-1.x86_64.rpm”

100%[======================================>] 16,227,107   162K/s   in 1m 44s

2014-11-10 00:05:23 (152 KB/s) - “influxdb-latest-1.x86_64.rpm” saved [16227107/16227107]

[ghj1976@localhost ~]$ ls
Documents  influxdb-latest-1.x86_64.rpm

[ghj1976@localhost ~]$ su -
Password:
[root@localhost ~]#

[root@localhost ~]# rpm -ivh /home/ghj1976/influxdb-latest-1.x86_64.rpm
Preparing...                ########################################### [100%]
   1:influxdb               ########################################### [100%]
[root@localhost ~]# ls
anaconda-ks.cfg  install.log  install.log.syslog
[root@localhost ~]# pwd
/root

中間碰到

user is not in the sudoers file.  This incident will be reported.

可以借鑒下面方式解決,或者直接用有root權限的賬號執行。

http://www.linuxidc.com/Linux/2010-12/30386.htm 

 

啟動服務

[root@localhost ~]# /etc/init.d/influxdb start
Setting ulimit -n 4096
Starting the process influxdb [ OK ]
influxdb process was started [ OK ]

 

由於這是一台本地測試虛機,我直接關閉了iptable

[root@localhost ~]# /etc/init.d/iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]

這台虛機的ip是:192.168.62.128, 所以我訪問默認的 8083 端口,就可以看到下面界面:

http://192.168.62.128:8083/

image

 

這里的用戶名和密碼 默認都是 root, 登錄進去就可以創建一個數據庫。

初始化數據,以及查詢可以看下圖:

image

我們先用 Write Point 增加數據,

輸入的  Time Series Name  是 log_lines

Values 是 {"line":"tewtstestw 123213 2354325 ghj 郭紅俊 "}

輸出成功后,我們執行 查詢: select * from log_lines ,就可以看到上圖的查詢結果。

 

一些用golang使用的代碼:

 

package main

import (
    "fmt"
    "github.com/influxdb/influxdb/client"
)

func main() {

    c, err := client.NewClient(&client.ClientConfig{
        Host:     "192.168.62.128:8086",
        Username: "root",
        Password: "root",
        Database: "test1",
    })

    if err != nil {
        panic(err)
    }

    name := "ts10"

    series := &client.Series{
        Name:    name,
        Columns: []string{"value"},
        Points: [][]interface{}{
            {1.0},
        },
    }
    if err := c.WriteSeries([]*client.Series{series}); err != nil {
        panic(err)
    }

    result, err := c.Query("list series")
    if err != nil {
        panic(err)
    }

    fmt.Println("\r\nlist series\r\n", result[0])

    result, err = c.Query("select * from " + name)
    if err != nil {
        panic(err)
    }

    fmt.Println("\r\nselect * from ", name, "\r\n", result[0])

}

各種組合查詢可以參考: http://www.oschina.net/p/influxdb

 

 

 

參考資料:

http://influxdb.com/docs/v0.8/introduction/getting_started.html

http://influxdb.com/docs/v0.8/introduction/installation.html


免責聲明!

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



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