• 大小: 24.86M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-26
  • 语言: C#
  • 标签: MySql  多线程  sql  12  文件  

资源简介

此实例的功能是:将阿里云CDN日志文件导入至mysql数据库,由于上传不了12G的文件,实例中带着 200M的 test.log文件

数据是每次提交10000条(可调整)到mysql,建议调整mysql的max_allowed_packet 参数,以便每次可提交更多的数据

资源截图

代码片段和文件信息

using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

namespace ReadBigFileDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            var taskList = new ConcurrentDictionary>();
            var path = Path.Combine(AppDomain.CurrentDomain.baseDirectory“file/test.log“);
            var connectConfig = new ConnectionConfig()
            {
                ConnectionString = “Datasource=localhost;Database=apiadmin;uid=root;pwd=root;Character Set=utf8;Allow User Variables=True“
                DbType = DbType.MySql
                IsAutoCloseConnection = t

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2020-04-16 15:34  .vs\
     目录           0  2020-04-16 16:00  .vs\ReadBigFileDemo\
     目录           0  2020-04-16 16:00  .vs\ReadBigFileDemo\DesignTimeBuild\
     文件      407774  2020-04-21 13:34  .vs\ReadBigFileDemo\DesignTimeBuild\.dtbcache
     目录           0  2020-04-16 15:34  .vs\ReadBigFileDemo\v16\
     文件       32256  2020-04-21 13:34  .vs\ReadBigFileDemo\v16\.suo
     目录           0  2020-04-16 15:34  .vs\ReadBigFileDemo\v16\Server\
     目录           0  2020-04-21 13:34  .vs\ReadBigFileDemo\v16\Server\sqlite3\
     文件           0  2020-04-16 15:34  .vs\ReadBigFileDemo\v16\Server\sqlite3\db.lock
     文件      880640  2020-04-21 13:34  .vs\ReadBigFileDemo\v16\Server\sqlite3\storage.ide
     目录           0  2020-04-21 13:33  ReadBigFileDemo\
     文件        5795  2020-04-21 13:33  ReadBigFileDemo\Program.cs
     文件         498  2020-04-21 13:32  ReadBigFileDemo\ReadBigFileDemo.csproj
     目录           0  2020-04-16 15:34  ReadBigFileDemo\bin\
     目录           0  2020-04-16 15:34  ReadBigFileDemo\bin\Debug\
     目录           0  2020-04-21 13:32  ReadBigFileDemo\bin\Debug\netcoreapp3.1\
     文件      294912  2017-12-21 20:23  ReadBigFileDemo\bin\Debug\netcoreapp3.1\Google.Protobuf.dll
     文件      135032  2019-03-22 05:06  ReadBigFileDemo\bin\Debug\netcoreapp3.1\Microsoft.Data.Sqlite.dll
     文件      702464  2019-01-28 07:41  ReadBigFileDemo\bin\Debug\netcoreapp3.1\MySql.Data.dll
     文件      693680  2019-11-09 00:56  ReadBigFileDemo\bin\Debug\netcoreapp3.1\Newtonsoft.Json.dll
     文件      660480  2018-02-27 20:36  ReadBigFileDemo\bin\Debug\netcoreapp3.1\Npgsql.dll
     文件     4562944  2018-09-11 14:31  ReadBigFileDemo\bin\Debug\netcoreapp3.1\Oracle.ManagedDataAccess.dll
     文件       74474  2020-04-21 13:32  ReadBigFileDemo\bin\Debug\netcoreapp3.1\ReadBigFileDemo.deps.json
     文件        9728  2020-04-21 13:33  ReadBigFileDemo\bin\Debug\netcoreapp3.1\ReadBigFileDemo.dll
     文件      169984  2020-04-21 13:33  ReadBigFileDemo\bin\Debug\netcoreapp3.1\ReadBigFileDemo.exe
     文件        2552  2020-04-21 13:33  ReadBigFileDemo\bin\Debug\netcoreapp3.1\ReadBigFileDemo.pdb
     文件         190  2020-04-16 18:30  ReadBigFileDemo\bin\Debug\netcoreapp3.1\ReadBigFileDemo.runtimeconfig.dev.json
     文件         154  2020-04-16 18:30  ReadBigFileDemo\bin\Debug\netcoreapp3.1\ReadBigFileDemo.runtimeconfig.json
     文件        5120  2018-12-18 15:00  ReadBigFileDemo\bin\Debug\netcoreapp3.1\SQLitePCLRaw.batteries_green.dll
     文件        5120  2018-12-18 15:00  ReadBigFileDemo\bin\Debug\netcoreapp3.1\SQLitePCLRaw.batteries_v2.dll
     文件       38400  2018-12-18 15:00  ReadBigFileDemo\bin\Debug\netcoreapp3.1\SQLitePCLRaw.core.dll
............此处省略76个文件信息

评论

共有 条评论