我剛開始嘗試influxDB和influxdb節點模塊。influxdb節點模塊沒有插入數據
我有以下代碼,每秒插入一些隨機數據。 我沒有收到任何錯誤,但沒有將數據添加到我的時間系列中。
代碼是
變種influxdb =要求( 'influxdb'); var sleep = require('sleep'); var connection = influxdb('172.21.5.67',8086); connection.auth({name}'root' ,password:'root'});
var db; var ISCSIDataSeries; (Math.random()*(high - low)+ low);返回Math.floor(Math.random()*(high - low)+ low);返回數學公式。 }
函數doInsert(i){db0 == undefined} {db0 = connection.database('test'); console.log('建立數據庫連接'); }
if (ISCSIDataSeries == undefined) { ISCSIDataSeries = db.series('SCSIData'); console.log('the series SCSIData is established'); } var reads = random(1000, 10000); var writes = random(2000, 20000); var IOS = random(100000, 1000000); ISCSIDataSeries.writePoints({ 'columns': ['Volume', 'Reads', 'Writes'], 'points': [reads, writes, IOS] } ); db.save(); }
var i = 0; while(i < 10){sleep} sleep(1);
doInsert(i); i ++; }
console.log('so long folks');
在運行結束時,我看不到輸入的數據。 這個包的任何經驗?
非常感謝。這是行得通的,我會切換到這個包。 – reza