阅读elastic search file system storage文档
This commit is contained in:
@@ -22,6 +22,9 @@
|
|||||||
- [Search Slow log](#search-slow-log)
|
- [Search Slow log](#search-slow-log)
|
||||||
- [identify search log origin](#identify-search-log-origin)
|
- [identify search log origin](#identify-search-log-origin)
|
||||||
- [index slow log](#index-slow-log)
|
- [index slow log](#index-slow-log)
|
||||||
|
- [Store](#store)
|
||||||
|
- [File System Storage types](#file-system-storage-types)
|
||||||
|
- [preloading data into the file system cache](#preloading-data-into-the-file-system-cache)
|
||||||
|
|
||||||
|
|
||||||
# index modules
|
# index modules
|
||||||
@@ -276,3 +279,50 @@ PUT /my-index-000001/_settings
|
|||||||
默认情况下,elasticsearch会打印slow log中头1000个字符。可以通过`index.indexing.slowlog.source`来修改该配置。
|
默认情况下,elasticsearch会打印slow log中头1000个字符。可以通过`index.indexing.slowlog.source`来修改该配置。
|
||||||
- 如果将`indexing.slowlog.source`设置为false或0,将会跳过对`source`的输出
|
- 如果将`indexing.slowlog.source`设置为false或0,将会跳过对`source`的输出
|
||||||
- 如果将`indexing.slowlog.source`设置为true,将会输出所有`source`的内容
|
- 如果将`indexing.slowlog.source`设置为true,将会输出所有`source`的内容
|
||||||
|
|
||||||
|
## Store
|
||||||
|
Store module控制如何对磁盘上的index data进行存储和访问。
|
||||||
|
### File System Storage types
|
||||||
|
对于存储类型,存在许多不同的实现。默认情况下,elasticsearch会基于操作系统选择最佳实现。
|
||||||
|
|
||||||
|
可以对所有index都显式的设置存储类型,需要修改`config/elasticsearch.yml`:
|
||||||
|
```
|
||||||
|
index.store.type: hybridfs
|
||||||
|
```
|
||||||
|
`index.store.type`为static设置,在索引创建时,可以针对每个索引进行单独设置:
|
||||||
|
```
|
||||||
|
PUT /my-index-000001
|
||||||
|
{
|
||||||
|
"settings": {
|
||||||
|
"index.store.type": "hybridfs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
如下列举了受支持的storage types:
|
||||||
|
- `fs`:默认file system实现,该设置会基于操作系统选择最佳的文件系统类型,目前在所有支持`hybridfs`的系统中都会选择hybirdfs,但是后续可能会改变。
|
||||||
|
- `simplefs`:`7.15`中已经被废弃
|
||||||
|
- `niofs`:`NIO FS`使用nio将shard index存储在文件系统中。其允许多个线程同时对一个文件进行读取。该文件系统不推荐在windows下使用。
|
||||||
|
- `mmapfs`:`MMAPFS`将shard index存储在文件系统中,并且会将文件映射到内存中。内存映射将会使用一部分虚拟内存空间地址,使用大小和文件大小相同,请确保有足够多的虚拟内存空间被分配。
|
||||||
|
- `hybirdfs`:`hybirdfs`是`niofs`和`mmapfs`的混合体,对于每种读取访问类型都会选择最佳的文件系统。
|
||||||
|
|
||||||
|
### preloading data into the file system cache
|
||||||
|
默认情况下,elasticsearch完全依赖操作系统文件系统的io操作缓存。可以通过设置`index.store.preload`来告知操作系统在打开索引时,将`hot index file`文件中的内容加载到内存中。
|
||||||
|
|
||||||
|
`index.store.preload`接受一个由`,`分隔的拓展名列表,所有后续名包含在列表中的文件都会被预加载到内存中。这将在操作系统重启、系统内存缓存丢失时极大改善性能。但是,这将会降低索引打开的速度,只有当`index.store.preload`中指定的内容加载到内存中时,索引才能够被访问。
|
||||||
|
|
||||||
|
该设置只会尽力而为,可能并不会起作用,取决于store type和操作系统。
|
||||||
|
|
||||||
|
`index.store.preload`是一个static设置,可以在`config/elasticsearch.yml`中设置:
|
||||||
|
```
|
||||||
|
index.store.preload: ["nvd", "dvd"]
|
||||||
|
```
|
||||||
|
在索引创建时,该配置项同样也可以设置:
|
||||||
|
```
|
||||||
|
PUT /my-index-000001
|
||||||
|
{
|
||||||
|
"settings": {
|
||||||
|
"index.store.preload": ["nvd", "dvd"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
该属性的默认值为`[]`,代表不会预加载任何内容。对于主动被搜索的
|
||||||
Reference in New Issue
Block a user