Bandwidthd+Postgresql数据库配置笔记

本系列文章由ex_net(张建波)编写,转载请注明出处。

http://blog.csdn.net/zjianbo/article/details/16717625

作者:张建波 邮箱: 281451020@qq.com 电话:13577062679 欢迎来电交流!

一、安装前的准备工作

(1)安装前请参考http://blog.csdn.net/zjianbo/article/details/16623879,了解Postgresql数据库的安装配置。

(2)创建 bandwidthd-pgsql 账号,该账户用来让Bandwidthd登录Postgresql数据库的

root@ubuntu:~# su - postgres
postgres@ubuntu:~$ psql
psql (9.1.9)
Type "help" for help. postgres=# CREATE USER bandwidthdpgsql;
CREATE ROLE
postgres=# ALTER USER bandwidthdpgsql PASSWORD '123456';
ALTER ROLE
postgres=# \q
postgres@ubuntu:~$ exit
logout
root@ubuntu:~#

(3)创建数据库

create database bandwidthdpgsql;

和第(2)步一样,还是用 su - postgres登录后执行

说明:

在Ubuntu下,不需要用 schema.postgresql 这个脚本创建表了。这一点和用源码安装方式有点不一样,可能是Ubuntu实在是考虑的比较周全把。

二、安装Bandwidthd软件包

apt-get install bandwidthd-pgsql

三、稍微修改Bandwidthd配置文件即可

vi /etc/bandwidthd/bandwidthd.conf

/etc/init.d/bandwidthd restart    #重启bandwidthd服务

启动后2~3分钟,用pgadmin工具看看数据库,就可以可能到数据了。

四、配置php页面

vi /etc/bandwidthd/debian-db.php

例如:

$dbuser='bandwidthdpgsql';
$dbpass='123456';
$basepath='';
$dbname='bandwidthdpgsql';
$dbserver='localhost';
$dbport='5432';
$dbtype='pgsql';

将Bandwidthd的php站点添加到apache里面

vi /etc/apache2/conf.d/bandwidthd

Alias /bandwidthd /var/lib/bandwidthd/htdocs

<Directory /var/lib/bandwidthd/htdocs>

DirectoryIndex index.php
AllowOverride None order deny,allow
deny from all
#allow from 127.0.0.0/255.0.0.0 ::1/128
allow from all <IfModule mod_php5.c>
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_value include_path .
</IfModule>
<IfModule !mod_php5.c>
<IfModule mod_actions.c>
<IfModule mod_cgi.c>
AddType application/x-httpd-php .php
Action application/x-httpd-php /cgi-bin/php
</IfModule>
<IfModule mod_cgid.c>
AddType application/x-httpd-php .php
Action application/x-httpd-php /cgi-bin/php
</IfModule>
</IfModule>
</IfModule> </Directory>

敲入上面的配置信息,当然,你可以用 phppgadmin的配置文件作为范本,cp一个出来修改哈即可。

这2步完成后,重启apache即可

/etc/init.d/apache2 restart

打开浏览器,选择你的传感器后,你就可以看到流量信息了。。。。

例如:http://192.168.1.4/bandwidthd/sensors.php

五、如果有不清楚的地方,用  man bandwidthd 看看

FILES
/usr/sbin/bandwidthd - daemon binary.
/etc/init.d/bandwidthd - startscript.
/etc/bandwidthd/bandwidthd.conf - configuration file.
/var/run/bandwidthd.pid - main process id file.
/var/lib/bandwidthd/ - log directory.
/var/lib/bandwidtd/htdocs/ - html and graphs output directory.

六、如果还有不明白的地方,推荐你看看下面的资料

(1) Ubuntu 12.04环境下配置Postgresql和phppgadmin   http://blog.csdn.net/zjianbo/article/details/16623879

(2)Bandwidthd完整实战笔记_1  http://blog.csdn.net/zjianbo/article/details/15026111

Bandwidthd+Postgresql数据库配置笔记的更多相关文章

  1. postgresql数据库配置csv格式的日志输出

    postgresql数据库配置csv格风格日志输出 以下介绍postgresql数据库中关于csv格式日志(pg中一种比較具体的日志输出方式)的设置方法. 1.进入$PGDATA文件夹(pg的安装文件 ...

  2. Mysql与PostgreSql数据库学习笔记---打酱油的日子

    mysql 从最基础的数据引擎,到进程结构,都不能支持数据版本.导致其职能阻塞“并发”,不支持最基本的事务,innodb达不到基本事务要求,任何写数据,都导致整个表锁住.充其量只能算是一个玩具,或者说 ...

  3. Mysql与PostgreSql数据库学习笔记

    mysql 从最基础的数据引擎,到进程结构,都不能支持数据版本.导致其职能阻塞“并发”,不支持最基本的事务,innodb达不到基本事务要求,任何写数据,都导致整个表锁住.充其量只能算是一个玩具,或者说 ...

  4. 建立安全SSL连接PostgreSQL数据库服务器

    建立安全SSL连接PostgreSQL数据库服务器当前物联网的挑战之一就是提供最高的安全级别.这就是为什么需要开启SSL连接到 PostgreSQL. 当你想要安全的存储数据到PostgreSQL数据 ...

  5. Spring Boot中使用PostgreSQL数据库

    在如今的关系型数据库中,有两个开源产品是你必须知道的.其中一个是MySQL,相信关注我的小伙伴们一定都不陌生,因为之前的Spring Boot关于关系型数据库的所有例子都是对MySQL来介绍的.而今天 ...

  6. 更改配置:远程访问gitlab的postgresql数据库

    作为这篇文章的补充: 将gitlab中的postgresql数据库开通远程访问 https://www.cnblogs.com/andy9468/p/10609682.html 替代(二)中的2.3. ...

  7. Windows下Postgresql数据库的下载与配置方法

    注意下载的是二进制版,不是带Windows Installer的,即绿色版本 http://www.enterprisedb.com/products-services-training/pgbind ...

  8. centos7下postgresql数据库安装及配置

    1.安装 #yum install -y postgresql-server 2.postgresql数据库初始化 #service postgresql initdb 3.启动postgresql服 ...

  9. PostgreSQL数据库基本配置

    一.安装 首先安装PostgreSQL客户端: sudo apt-get install postgresql-client 然后,安装PostgreSQL服务器: sudo apt-get inst ...

随机推荐

  1. opencv 图像修复函数

    void cv::inpaint( const Mat& src, const Mat& mask, Mat& dst, double inpaintRange, int fl ...

  2. js获取手机重力感应api

    <html> <head> <title>DeviceOrientationEvent</title> <meta charset="U ...

  3. 用纯jsp实现用户的登录、注册与退出

    用户的登录.注册和退出是一个系统最常见的功能,现将各功能用jsp代码表示出来 用户的登录: 其中connDB是数据库连接类,将用户名username放入session中 <%@ page con ...

  4. WPF 采用Border创建圆角

    通过设置可以创建圆角border的CornerRadius属性其边框呈现圆角样式 代码: <Border Height="50" Background="Red&q ...

  5. JTable只要一双击就进入编辑状态,禁止的方法实现

    我用JTable做了一个表格,表格内容只供查看和选择,可每次只要一双击,就进入编辑状态,可是现在我不需要当双击的时候修改表格的内容.这时候需要重载isCellEditable方法. 下面是我的实现的代 ...

  6. 我的学习笔记之API-Guides翻译------AppComponent_Activites

    10.26第一天开始:贵在坚持,边看遍整理 一个应用程序通常由多个Activity组成,它们之间是松耦合的关系.特别的,有一个Activity作为app的主Activity,当app首次启动时呈现给用 ...

  7. 错误:类Byte是公共的,应在名为Byte.java 的文件中声明public class Byte{}一个错误

      解决:文件名是xyz,那你的这个类名也应该是xyz.

  8. 测试heightlight

    var a = '综合型律师事务所'; if (a == '综合型律师事务所') { initradio('ls_classes', '综合型律师事务所'); } else { initradio(' ...

  9. As Easy As A+B

    Problem Description These days, I am thinking about a question, how can I get a problem as easy as A ...

  10. C++学习之this指针

    C++学习之this指针 一个对象的this指针并不是对象本身的一部分,不会影响sizeof(对象)的结果.this作用域是在类内部,当在类的非静态成员函数中访问类的非静态成员的时候,编译器会自动将对 ...