influxdb 的安裝(centos)

安裝命令:html

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

具體安裝過程以下:git

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」 github

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

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 ide

[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.net

中間碰到htm

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

相關文章
相關標籤/搜索