Thinking Sphinx:索引时出错
索引索引'users_core'...
错误:索引“users_core”:sql_range_query:表“/tmp/#sql_ff2_0.MYI”的密钥文件不正确;尝试修复它 (DSN=mysql://root:*@localhost:3306/myname)
这意味着什么?
我找不到文件“/tmp/#sql_ff2_0.MYI”
我该如何修复它?
indexing index 'users_core'...
ERROR: index 'users_core': sql_range_query: Incorrect key file for table '/tmp/#sql_ff2_0.MYI'; try to repair it (DSN=mysql://root:*@localhost:3306/myname)
What does this means ?
I can't find the file '/tmp/#sql_ff2_0.MYI'
How do i repair it ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这实际上与 Ruby / Rails 无关,我自己也遇到过这个问题,并且在找到真正的答案时遇到了很大的困难。
问题在于 sphinx 索引器脚本在构建索引时尝试创建临时 MySQL 表。在我的例子中,MySQL 的临时表磁盘空间不足(默认为
/tmp
,我的分区只有 2GB),当数据添加到临时表并且磁盘已满时,表就会损坏,因为写入临时表的最后一位数据被截断。
解决方案是确保 MySQL 写入临时表的驱动器上有足够的空间。我最终将 my.cnf 中的临时目录更改为另一个更大的分区。 debian 上配置文件的默认位置是
/etc/mysql/my.cnf
添加:
tmpdir = /var/lib/mysql/tmp
放置它的最佳位置是下一个到
[mysqld]
部分中的datadir
设置。This actually has nothing to do with Ruby / Rails, I just ran into this myself and had quite a bit of trouble finding a real answer.
The issue is that the sphinx indexer script is trying to create a temporary MySQL table while building the index. In my case MySQL ran out of disk space for the temporary table (default is
/tmp
, my partition was only 2GB)As data is added to this temporary table and the disk is filled the table becomes corrupt, because the last bit of data written to the temp table is truncated.
The solution is to ensure the drive that MySQL is writing temporary tables to has enough space on it. I ended up changing the temp directory in
my.cnf
to a different larger partition. Default location for the config file on debian is/etc/mysql/my.cnf
Add:
tmpdir = /var/lib/mysql/tmp
Best place to put it is next to the
datadir
setting in the[mysqld]
section.这可能是 mysql 在查询期间创建的一些临时表。
您是否尝试修复在 sql_range_query 中使用的主表?
This is perhaps some temporary table mysql creates during the query.
Did you try to repair the main table you use in the sql_range_query ?