{"id":19991894,"url":"https://github.com/stulzq/Influxdb.BulkInsert","last_synced_at":"2025-05-04T11:30:27.394Z","repository":{"id":95704684,"uuid":"150746030","full_name":"stulzq/Influxdb.BulkInsert","owner":"stulzq","description":"Influxdb asynchronous, fast and bulk insert components.Using HTTP or UDP protocol.Influxdb 异步、快速、批量插入组件，支持http和udp协议。","archived":false,"fork":false,"pushed_at":"2022-01-20T03:17:47.000Z","size":31,"stargazers_count":14,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T20:17:01.972Z","etag":null,"topics":["influxdb","influxdb-bulk-insert"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stulzq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-28T13:38:07.000Z","updated_at":"2025-01-19T14:02:56.000Z","dependencies_parsed_at":"2023-03-09T13:00:36.041Z","dependency_job_id":null,"html_url":"https://github.com/stulzq/Influxdb.BulkInsert","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stulzq%2FInfluxdb.BulkInsert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stulzq%2FInfluxdb.BulkInsert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stulzq%2FInfluxdb.BulkInsert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stulzq%2FInfluxdb.BulkInsert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stulzq","download_url":"https://codeload.github.com/stulzq/Influxdb.BulkInsert/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252285417,"owners_count":21723722,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["influxdb","influxdb-bulk-insert"],"created_at":"2024-11-13T04:51:57.505Z","updated_at":"2025-05-04T11:30:27.023Z","avatar_url":"https://github.com/stulzq.png","language":"C#","funding_links":[],"categories":["C\\#"],"sub_categories":[],"readme":"# Influxdb.BulkInsert\n\n[![Latest version](https://img.shields.io/nuget/v/Influxdb.BulkInsert.svg?style=flat-square)](https://www.nuget.org/packages/Influxdb.BulkInsert/)\n\nInfluxdb 异步、快速、批量插入组件，支持http和udp协议，目前不支持https。\n\n## 开始\n\n### 1.HTTP\n\n````csharp\nvar insert = new InfluxHttpBulkInsert(new InfluxConnectionSetting() { Server = \"192.168.10.110\", Port = 8086,Database = \"kong\",BitchSize = 5000});\nvar processor = new InfluxBulkInsertProcessor(insert);\n\nprocessor.Open();\nfor (int i = 0; i \u003c 1000; i++)\n{\n    processor.Write($\"test,type='cpu' value=1 {InfluxdbTimeGen.GenNanosecond()}\");\n}\n\nConsole.WriteLine(\"Complete\");\nConsole.Read();\nprocessor.Close();\n````\n\n### 2.UDP\n\n````csharp\nvar insert = new InfluxUdpBulkInsert(new InfluxConnectionSetting() { Server = \"192.168.10.110\", Port = 8089,BitchSize = 10});\nvar processor = new InfluxBulkInsertProcessor(insert);\n\nprocessor.Open();\nfor (int i = 0; i \u003c 1000; i++)\n{\n    processor.Write($\"test,type='cpu' value={i} {InfluxdbTimeGen.GenNanosecond()}\");\n}\nConsole.WriteLine(\"Complete\");\nConsole.Read();\nprocessor.Close();\n````\n\n## 使用规范\n\n### 1.写入的数据**末尾**字符不得带换行 ”\\n“\n\n这种不被允许:\n````sql\ntest,type='cpu' value=1\\n\ntest,type='cpu' value=1\\ntest,type='cpu' value=1\\n\n````\n\n这种允许：\n````sql\ntest,type='cpu' value=1\ntest,type='cpu' value=1\\ntest,type='cpu' value=1\n````\n\n### 2.写入数据必须带上时间戳\n\n因为发送数据是按批次发送，如果批次的数据数量大于1（BitchSize）,那么数据是合并发送的，这时需要每条数据都带上时间戳，不然数据将会被覆盖。可以使用 `InfluxdbTimeGen.GenNanosecond()`来生成纳秒时间戳，时间戳必须为纳秒。\n\n### 3.数据格式\n\n````sql\n\u003cmeasurement\u003e,\u003ctags\u003e \u003cfields\u003e \u003ctime\u003e\n````\n\n示例：\n\n````sql\ntest,type='cpu' value=1 1539076079817999232\ntest,type='cpu' value=1 1539076079817999232\\ntest,type='cpu' value=1 1539076079817999232\n````\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstulzq%2FInfluxdb.BulkInsert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstulzq%2FInfluxdb.BulkInsert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstulzq%2FInfluxdb.BulkInsert/lists"}