lz4

为什么我们要从 MySQL 迁移到 TiDB?

断了今生、忘了曾经 提交于 2020-03-26 12:40:23
3 月,跳不动了?>>> 本文转载自公众号 51CTO技术栈 。 **作者介绍:**贺磊,360 数据库运维资深工程师,《MongoDB 运维实战作者》,知名论坛 MySQL 版主,51CTO 博客之星,闲暇之余,喜欢将部分案例写成博客,累计访问量过百万。 我先说几个最让你兴奋和开心的点吧: 在 TiDB 里,你完全不用担心磁盘容量的问题。 在 TiDB 里,原生支持 Online DDL,你完全不用担心第三方改表工具改表出现各种 Bug 的问题,相信用开源工具改过上 T 级别表的同学都遇到过或多或少的各类 error。 在 TiDB 里,加列、主键扩容字段都是秒级的,比如我刚刚就刚对一张 19 亿的表加完了字段,1 秒完事,这在 MySQL 里要 8.0 才可以,而且还要求列在最后才行。 在 TiDB 里,你会发现 count(*) 惊人的快,一张近 20 亿的表 coun(*) 大概在 1 分钟完事儿,当然,这取决于你的 KV 数量和磁盘性能。 在 TiDB 里,从 MySQL 迁移将变得简单,图形化一键迁移,爽不爽? 在 TiDB 里,绝大多数情况你会发现比单机 MySQL 有更好的性能,当然也不排除一些例外,例如 enum 这样奇葩的字段类型。 在 TiDB 里......您且往下看,我慢慢和您说。 使用背景 60 云平台对 360 集团各大业务线均有提供服务支持

Cassandra最佳实践(3)配置篇

£可爱£侵袭症+ 提交于 2020-03-25 09:14:26
3 月,跳不动了?>>> 本篇文章我们主要介绍cassandra的相关配置,我把cassandra的相关配置中个人觉得相对比较重要的按照集群、节点这个横向维度进行介绍,可能有的配置我不会列在这里,那么具有见cassandra.yaml里面的详细介绍;如何配置cassandra,需要在集群启动的时候在conf目录下面的cassandra.yaml里面进行配置即可。此外我们的配置需要遵守yaml文件配置规则。本处以3.11.4进行介绍 集群维度 cluster_name: //集群的名字,默认是Test Cluster,用''括起来。不同的cluster name的节点无法组成一个集群 num_tokens: 256 //集群中单节点的的分配token数,因为使用vnode,也就是vnode的个数,每个token是随机生成的,此外如果不使用vnode的话,可以使用每个节点预分配一个初始的token,通过下面的配置下; initial_token: //如果集群不想使用vnode的话,需要手工给每个节点进行token配置,手工计算节点的token数,但是扩容的时候建议是成倍扩容。vnode不需要 partitioner: //集群的数据分配算法,也就是常见的一致性hash算法中计算hash的那个模块,其中默认使用org.apache.cassandra.dht

使用mysqldump跳过某些表

孤街醉人 提交于 2020-02-27 01:15:18
有没有办法从mysqldump命令限制某些表? 例如,我使用以下语法 只 转储table1和table2: mysqldump -u username -p database table1 table2 > database.sql 但是有没有类似的方法来转储 除 table1和table2 之外的 所有表? 我还没有在mysqldump文档中找到任何内容,那么brute-force(指定所有表名)是唯一的方法吗? #1楼 对于多个数据库: mysqldump -u user -p --ignore-table=db1.tbl1 --ignore-table=db2.tbl1 --databases db1 db2 .. #2楼 基于@Brian-Fisher的回答并回答了一些人对这篇文章的评论,我在我的数据库中有一堆巨大的(和不必要的)表,所以我想在复制时跳过它们的内容,但保留结构: mysqldump -h <host> -u <username> -p <schema> --no-data > db-structure.sql mysqldump -h <host> -u <username> -p <schema> --no-create-info --ignore-table=schema.table1 --ignore-table=schema.table2 > db

How to know when the output buffer is too small when decompressing with LZ4?

…衆ロ難τιáo~ 提交于 2019-12-23 12:54:11
问题 The documentation of LZ4_decompress_safe says: /*! LZ4_decompress_safe() : compressedSize : is the precise full size of the compressed block. maxDecompressedSize : is the size of destination buffer, which must be already allocated. return : the number of bytes decompressed into destination buffer (necessarily <= maxDecompressedSize) If destination buffer is not large enough, decoding will stop and output an error code (<0). If the source stream is detected malformed, the function will stop

How to use tar with lz4?

六眼飞鱼酱① 提交于 2019-12-20 15:18:14
问题 How to use tar and filter the archive through LZ4? Or any available tools? It looks cumbersome to use tar cvf folderABC.tar folderABC && lz4c -c0 folderABC.tar . PS: *nix environment 回答1: lz4 has a command line structure similar to gzip. Therefore, something like this will work : tar cvf - folderABC | lz4 > folderABC.tar.lz4 or tar cvf - folderABC | lz4 - folderABC.tar.lz4 First one compresses silently, like gzip. Second one is a bit more lz4-specific, and will also display summarized

Error: Unexpected end of stream. Data might be corrupted

不羁岁月 提交于 2019-12-11 15:58:39
问题 I'm trying something with stream data. I'm getting an error. I have some codes like below. One of both works, but another is not. This code works properly. private static void Main_2() { { var i = 1000000; var bf = new BinaryFormatter(); var ms = new MemoryStream(); bf.Serialize(ms, i); ms.Position = 0; Stream mem = File.Create("test.lz4"); LZ4EncoderStream target = LZ4Stream.Encode(mem); ms.CopyTo(target); target.Dispose(); ms.Dispose(); mem.Dispose(); } { Stream source = File.OpenRead("test

Compression using LZ4Net

荒凉一梦 提交于 2019-12-11 05:32:56
问题 I'm trying to compress multiple files with lz4net, but I don't even know how to begin. I have string[] or List<string> with filepaths (and relative paths) and want to compress it with lz4 to one file. Later I want to decompress it with taking care about the relative paths. 回答1: Download the LZ4 dll. Create a buffer for each file: public byte[] FileToByteArray(string fileName) { byte[] buff = null; FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); BinaryReader br = new

Decompressing LZ4 compressed data in Spark

荒凉一梦 提交于 2019-12-10 17:39:13
问题 I have LZ4 compressed data in HDFS and I'm trying to decompress it in Apache Spark into a RDD. As far as I can tell, the only method in JavaSparkContext to read data from HDFS is textFile which only reads data as it is in HDFS. I have come across articles on CompressionCodec but all of them explain how to compress output to HDFS whereas I need to decompress what is already on HDFS. I am new to Spark so I apologize in advance if I missed something obvious or if my conceptual understanding is

Kafka源码解读——动态加载class类,减少项目依赖包

£可爱£侵袭症+ 提交于 2019-12-06 02:30:55
Java动态加载class类 最常见的一种场景,某些功能服务项目里根本没有使用到,但是因为项目里引用了该依赖包的class类,所以你不得不在即使没有使用到该服务的情况下,仍让要添加依赖到项目中。 但是通过动态加载class类,可以让你的项目大大减少第三方包的依赖。 核心思路就是通过反射和基本的判断语句去控制对象的实例化。 以Kafka源码为例: 以下是kafka中的压缩模块代码 public Compressor(ByteBuffer buffer, CompressionType type) { this.type = type; this.initPos = buffer.position(); ...... appendStream = wrapForOutput(bufferStream, type, COMPRESSION_DEFAULT_BUFFER_SIZE); // kafka数据压缩函数 } // the following two functions also need to be public since they are used in MemoryRecords.iteration static public DataOutputStream wrapForOutput(ByteBufferOutputStream buffer,

Comparison between lz4 vs lz4_hc vs blosc vs snappy vs fastlz

半腔热情 提交于 2019-12-04 10:15:03
问题 I have a large file of size 500 mb to compress in a minute with the best possible compression ratio. I have found out these algorithms to be suitable for my use. lz4 lz4_hc snappy quicklz blosc Can someone give a comparison of speed and compression ratios between these algorithms? 回答1: Yann Collet's lz4, hands down. 回答2: This migth help you: (lz4 vs snappy) http://java-performance.info/performance-general-compression/ (benchmarks for lz4, snappy, lz4hc, blosc) https://web.archive.org/web