zoukankan      html  css  js  c++  java
  • 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(" list series ", result[0])

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

        fmt.Println(" select * from ", name, " ", 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

  • 相关阅读:
    zookeeper使用场景
    zookeeper安装配置
    hadoop 远程调试
    deep learning笔记
    Sentiment Analysis(1)-Dependency Tree-based Sentiment Classification using CRFs with Hidden Variables
    PRML阅读笔记 introduction
    Python 学习笔记(2)
    python nltk 学习笔记(5) Learning to Classify Text
    python nltk 学习笔记(4) Writing Structured Programs
    python nltk 学习笔记(3) processing raw text
  • 原文地址:https://www.cnblogs.com/ghj1976/p/4087649.html
Copyright © 2011-2022 走看看