Home Database Mysql Tutorial 2.MariaDB激活二进制日志_MySQL

2.MariaDB激活二进制日志_MySQL

Jun 01, 2016 pm 01:26 PM
binary data center

MariaDB

bitsCN.com

翻译人员: 铁锚

翻译时间: 2013年12月25日

原文地址: Activating the Binary Log
参考了: 《高可用MySQL 构建健壮的数据中心》

要启用二进制日志功能,可以使用 "--log-bin[=name]"选项来启动服务器.
如果文件名中包含了后缀(例如 "--log-bin[=master-bin.log]"),则后缀(".log")将会被忽略.
如果没有指定文件名,默认使用 datadir/log-basename-bin, datadir/mysql-bin 或者 datadir/mariadb-bin(如果也没有 --log-basename选项,根据server版本的不同,会使用后两个中的一个);
datadir 是存放数据(data)的目录,由系统变量 datadir 定义.(启动参数 --datadir=path 或者-h path);
强烈建议: 使用 --log-basename 或者指定二进制日志的文件名,以便服务器的hostname改变以后也不影响复制(replication );
存储二进制日志的目录,用于存放 各个独立的二进制日志文件,以及对这些文件的二进制日志索引(文件).
二进制日志文件的扩展名是一序列的数字.每增加一个日志文件,扩展名的数字就会增加;所以较老的日志的扩展名数字较小,最近的日志的扩展名数字最大。
每次服务器启动,就会启用一个新的二进制日志,当然扩展名也是新的;启动或停止时日志会被强制写入物理文件(平时可能存储在内存缓存中,由操作系统决定何时写入).也可以通过定义max_binlog_size 变量来指定一个数字,当日志累增到此值就会强制写入硬盘.
二进制日志索引文件按顺序储存着所有的二进制日志文件的索引.
datadir下的文件列表示例如下:

1

shell> ls -l total 100...-rw-rw---- 1 mysql adm 2098 Apr 19 00:46 mariadb-bin.000079-rw-rw---- 1 mysql adm  332 Apr 19 00:56 mariadb-bin.000080-rw-rw---- 1 mysql adm  347 Apr 19 07:36 mariadb-bin.000081-rw-rw---- 1 mysql adm  306 Apr 20 07:15 mariadb-bin.000082-rw-rw---- 1 mysql adm  332 Apr 20 07:41 mariadb-bin.000083-rw-rw---- 1 mysql adm  373 Apr 21 07:56 mariadb-bin.000084-rw-rw---- 1 mysql adm  347 Apr 21 09:09 mariadb-bin.000085-rw-rw---- 1 mysql adm  398 Apr 21 21:24 mariadb-bin.000086-rw-rw---- 1 mysql adm  816 Apr 21 17:05 mariadb-bin.index

Copy after login

二进制日志index文件的名字部分默认与其他的二进制日志文件相同,而扩展名使用".index",当然,index文件的名字也可以通过"--log-bin-index[=filename] " 选项来单独指定.
具有 SUPER 权限的客户端,可以通过设置 sql_log_bin 变量,来为此次会话禁用或者再次启用二进制日志;
(sql_log_bin 是一个session变量,默认值是1,只有具有 SUPER 权限的客户端可以设置;设置为 0 则此客户端的的操作将不记入二进制日志;)
示例如下:

1

MariaDB [test]> SET sql_log_bin = 0;MariaDB [test]> SET sql_log_bin = 1;

Copy after login

二进制日志的格式
二进制日志有三种格式:
默认是 基于语句的日志(statement-based);
row-based是基于行的日志;
mix是可以混合前面两种日志的格式;
详情请参考: Binary Log Formats
MariaDB服务器所有的配置选项参见: mysqld Options (full list)
MariaDB服务器系统变量参见: Server System Variables bitsCN.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Gartner: Generative AI will drive the transformation of Chinese enterprise data center design Gartner: Generative AI will drive the transformation of Chinese enterprise data center design Apr 16, 2024 pm 10:41 PM

According to news on April 15, 2024, a 2024 CIO and technology executive survey recently released by Gartner shows that more than 60% of Chinese companies plan to deploy generative artificial intelligence (GenAI) in the next 12 to 24 months. Since Chinese companies tend to deploy GenAI locally rather than through the public cloud, the current infrastructure environment cannot support GenAI projects. This will promote the design transformation of Chinese enterprise data centers. Zhang Lukeng, research director at Gartner, said: "Due to security and data privacy concerns and regulatory requirements, some enterprises prefer to deploy GenAl solutions or fine-tune large language models (LLM) on-premises. Deploying GenAl on-premises is important for data centers not just

Samsung introduces BM1743 data center-grade SSD: equipped with v7 QLC V-NAND and supports PCIe 5.0 Samsung introduces BM1743 data center-grade SSD: equipped with v7 QLC V-NAND and supports PCIe 5.0 Jun 18, 2024 pm 04:15 PM

According to news from this website on June 18, Samsung Semiconductor recently introduced its next-generation data center-grade solid-state drive BM1743 equipped with its latest QLC flash memory (v7) on its technology blog. ▲Samsung QLC data center-grade solid-state drive BM1743 According to TrendForce in April, in the field of QLC data center-grade solid-state drives, only Samsung and Solidigm, a subsidiary of SK Hynix, had passed the enterprise customer verification at that time. Compared with the previous generation v5QLCV-NAND (note on this site: Samsung v6V-NAND does not have QLC products), Samsung v7QLCV-NAND flash memory has almost doubled the number of stacking layers, and the storage density has also been greatly improved. At the same time, the smoothness of v7QLCV-NAND

How to calculate binary arithmetic How to calculate binary arithmetic Jan 19, 2024 pm 04:38 PM

Binary arithmetic is an operation method based on binary numbers. Its basic operations include addition, subtraction, multiplication and division. In addition to basic operations, binary arithmetic also includes logical operations, displacement operations and other operations. Logical operations include AND, OR, NOT and other operations, and displacement operations include left shift and right shift operations. These operations have corresponding rules and operand requirements.

What are the two major improvements of EDVAC? What are the two major improvements of EDVAC? Mar 02, 2023 pm 02:58 PM

EDVAC has two major improvements: one is the use of binary, and the other is the completion of stored programs, which can automatically advance from one program instruction to the next, and its operations can be automatically completed through instructions. "Instructions" include data and programs, which are input into the memory device of the machine in the form of codes, that is, the same memory device that stores data is used to store instructions for performing operations. This is the new concept of so-called stored programs.

How to convert binary to hexadecimal using C language? How to convert binary to hexadecimal using C language? Sep 01, 2023 pm 06:57 PM

Binary numbers are represented by 1s and 0s. The 16-bit hexadecimal number system is {0,1,2,3…..9,A(10),B(11),…F(15)} in order to convert from binary representation to hexadecimal Represents that the bit string ID is grouped into 4-bit chunks, called nibbles starting from the least significant side. Each block is replaced with the corresponding hexadecimal number. Let us see an example to get a clear understanding of hexadecimal and binary number representation. 001111100101101100011101 3 E 5 B&nb

How to read binary files in Golang? How to read binary files in Golang? Mar 21, 2024 am 08:27 AM

How to read binary files in Golang? Binary files are files stored in binary form that contain data that a computer can recognize and process. In Golang, we can use some methods to read binary files and parse them into the data format we want. The following will introduce how to read binary files in Golang and give specific code examples. First, we need to open a binary file using the Open function from the os package, which will return a file object. Then we can make

Easily learn to convert hexadecimal to binary in Go language Easily learn to convert hexadecimal to binary in Go language Mar 15, 2024 pm 04:45 PM

Title: Easily learn to convert hexadecimal to binary in Go language. Specific code examples are required. In computer programming, conversion operations between different base numbers are often involved. Among them, conversion between hexadecimal and binary is relatively common. In the Go language, we can achieve hexadecimal to binary conversion through some simple code examples. Let us learn together. First, let's take a look at the representation methods of hexadecimal and binary. Hexadecimal is a method of representing numbers, using 0-9 and A-F to represent 1

Inspur Information and Intel jointly release the world's first fully liquid-cooled cold plate server reference design Inspur Information and Intel jointly release the world's first fully liquid-cooled cold plate server reference design Jan 19, 2024 am 10:27 AM

News from this site on January 19. According to official news from Inspur Server, on January 18, Inspur Information and Intel jointly released the world’s first fully liquid-cooled cold plate server reference design and opened it to the industry to promote fully liquid-cooled cold plate solutions. Large-scale deployment of applications in global data centers. Based on this reference design, Inspur Information launched a fully liquid-cooled cold plate server, claiming to achieve nearly 100% liquid cooling of server components and achieve a PUE value close to 1. Note from this site: PUE is the abbreviation of Power Usage Effectiveness. The calculation formula is "total data center energy consumption/IT equipment energy consumption". The total data center energy consumption includes IT equipment energy consumption and energy consumption of cooling, power distribution and other systems. The higher the PUE Close to 1 represents non-IT equipment consumption

See all articles