`
cocos
  • 浏览: 401521 次
  • 性别: Icon_minigender_1
  • 来自: 福州
社区版块
存档分类
最新评论

External Locking skip-external-locking

阅读更多

External locking is the use of file system locking to manage contention for MyISAM database tables by multiple processes. External locking is used in situations where a single process such as the MySQL server cannot be assumed to be the only process that requires access to tables. Here are some examples:

  • If you run multiple servers that use the same database directory (not recommended), each server must have external locking enabled.

  • If you use myisamchk to perform table maintenance operations on MyISAM tables, you must either ensure that the server is not running, or that the server has external locking enabled so that it locks table files as necessary to coordinate with myisamchk for access to the tables. The same is true for use of myisampack to pack MyISAM tables.

    If the server is run with external locking enabled, you can use myisamchk at any time for read operations such a checking tables. In this case, if the server tries to update a table that myisamchk is using, the server will wait for myisamchk to finish before it continues.

    If you use myisamchk for write operations such as repairing or optimizing tables, or if you use myisampack to pack tables, you must always ensure that the mysqld server is not using the table. If you don't stop mysqld , you should at least do a mysqladmin flush-tables before you run myisamchk . Your tables may become corrupted if the server and myisamchk access the tables simultaneously.

With external locking in effect, each process that requires access to a table acquires a file system lock for the table files before proceeding to access the table. If all necessary locks cannot be acquired, the process is blocked from accessing the table until the locks can be obtained (after the process that currently holds the locks releases them).

External locking affects server performance because the server must sometimes wait for other processes before it can access tables.

外部锁定会影响系统性能

 

默认情况下,是不需要外部锁定的,

External locking is unnecessary if you run a single server to access a given data directory (which is the usual case) and if no other programs such as myisamchk need to modify tables while the server is running. If you only read tables with other programs, external locking is not required, although myisamchk might report warnings if the server changes tables while myisamchk is reading them.

With external locking disabled, to use myisamchk , you must either stop the server while myisamchk executes or else lock and flush the tables before running myisamchk . (See Section 7.9.1, “System Factors and Startup Parameter Tuning” .) To avoid this requirement, use the CHECK TABLE and REPAIR TABLE statements to check and repair MyISAM tables.

For mysqld , external locking is controlled by the value of the skip_external_locking system variable. When this variable is enabled, external locking is disabled, and vice versa. From MySQL 4.0 on, external locking is disabled by default.

Use of external locking can be controlled at server startup by using the --external-locking or --skip-external-locking option.

If you do use external locking option to enable updates to MyISAM tables from many MySQL processes, you must ensure that the following conditions are satisfied:

  • You should not use the query cache for queries that use tables that are updated by another process.

  • You should not start the server with the --delay-key-write=ALL option or use the DELAY_KEY_WRITE=1 table option for any shared tables. Otherwise, index corruption can occur.

The easiest way to satisfy these conditions is to always use --external-locking together with --delay-key-write=OFF and --query-cache-size=0 . (This is not done by default because in many setups it is useful to have a mixture of the preceding options.)

分享到:
评论

相关推荐

    MySQL性能参数详解之Skip-External-Locking参数介绍

    MySQL中的`Skip-External-Locking`参数是一个关键的性能配置选项,主要针对使用MyISAM存储引擎的数据库表。在MySQL的配置文件`my.cnf`中,这个参数默认是启用的,意味着它会跳过对数据库文件的外部锁定机制。 外部...

    MySQL错误Forcing close of thread的两种解决方法

    最近网站访问量大增,可能有些频道程序也有一些问题,...注意:在新版本的mysql中,skip-locking已经被换成了skip-external-locking,如果使用skip-locking,可能会报如下错误: [Warning] ‘–skip-locking’ is depr

    mysql配置文件参数详解

    skip-external-locking #External-locking用于多进程条件下为MyISAM数据表进行锁定。如果你有多台服务器使用同一个数据库目录(不建议),那么每台服务器都必须开启external locking; skip-name-resolve #禁止MySQL...

    Linux编译安装mysql容易出现的问题解决方法[参考].pdf

    使用`scripts/mysql_install_db`或`bin/mysql_install_db`初始化数据库时,可能遇到关于`--skip-locking`被弃用的警告,应将其替换为`--skip-external-locking`。在my.cnf配置文件中,找到相应的行进行修改即可。 ...

    MySQL之my.cnf配置完美详解.

    - "skip-external-locking"防止外部锁定,减少错误概率,增强稳定性。 - "skip-slave-start"在启动MySQL时不启动复制功能。 - "skip-networking"关闭MySQL的TCP/IP连接方式,如果WEB服务器是远程连接到MySQL数据库...

    linux下mysql命令[定义].pdf

    $ ./mysqld_safe --defaults-file=/path/to/my.cnf --basedir=/path/to/mysql/installation --datadir=/path/to/data/directory --pid-file=/path/to/pid/file --skip-external-locking --port=8100 --socket=/path...

    mysql自动停止 Plugin FEDERATED is disabled 的完美解决方法

    4. 考虑添加优化选项,如`skip-external-locking`和`skip-name-resolve`,以提升服务性能。 通过这些步骤,可以有效地解决MySQL服务的稳定性问题,确保数据库的正常运行。对于类似问题,应养成定期检查日志、更新...

    MyISAM和InnoDB引擎优化分析

    IBM S226 CPU:至强四核 内存:4G 硬盘:两个80G做RAID1 系统:windows server 2003 SP1 32位企业版 Mysql版本:5.5 根据自己服务器的实际情况,优化过和参数如下: 一、公共选项 skip-external-locking //避免MySQL...

    mysql服务性能优化my_cnf配置说明详解16G内存[参考].pdf

    默认情况下,External Locking 是开启的,可以使用 –skip-external-locking 选项以避免外部锁定。 7. 最大允许包大小(Max Allowed Packet) Max Allowed Packet 是 MySQL 服务器的一个参数,它指定了在网络传输...

    mysql5.1.55安装步骤.docx

    - 编辑 `/etc/my.cnf` 文件,调整配置,例如将 `skip-locking` 更改为 `skip-external-locking`,并添加 `datadir` 设置。 7. **初始化数据库**: - 使用 `mysql_install_db` 初始化系统数据库,并启动 MySQL ...

    mysql安装心得

    - 参数调整:在MySQL 5.6中,`skip-locking`参数不再适用,应改为`skip-external-locking`,这会影响数据库的锁定机制。 - **2014/06/12**: - InnoDB参数设置:InnoDB引擎是MySQL中的事务处理引擎,配置如`...

    Linux上安装mysql.docx

    3. 添加`skip-external-locking`和`skip-name-resolve`这两行,以防止因DNS解析问题导致的问题。 4. 保存文件后,重启MySQL服务,使用`sudo service mysql restart`。 如果想要限制远程访问,而不是允许所有IP,...

    配置说明文件

    - **skip-external-locking**:禁用外部锁定机制,通常用于提高并发性。 - **skip-name-resolve**:禁用DNS解析,可以提高启动速度和连接性能。 - **explicit_defaults_for_timestamp**:启用此选项后,TIMESTAMP列...

    MySQL8.0.19安装教程

    skip-external-locking skip-name-resolve datadir=/data/mysql tmpdir=/data/tmp secure_file_priv=/data/tmp ... ``` 配置完成后,启动MySQL服务并设置开机启动: ```bash cd /usr/local/mysql/bin/ ./mysqld_...

    编译安装lamp所需要的安装包

    skip-external-locking key_buffer_size = 16M max_allowed_packet = 1M table_open_cache = 64 sort_buffer_size = 512K read_buffer_size = 256K read_rnd_buffer_size = 256K net_buffer_length = 8K ...

Global site tag (gtag.js) - Google Analytics