loki报错与解决方法:failed to initialize table

笔者今天发现使用的loki报错了,启动报错退出,上网查询,没找到雷同的问题,所以只能自己查找原因解决。具体报错原因如下:

level=info ts=2023-02-16T00:20:37.982109877Z caller=index_set.go:422 table-name=netflow_19397 file-name=w73-1666251570274129777-1675941300.gz msg="downloaded file" total_time=90.712582ms
level=info ts=2023-02-16T00:20:37.982148872Z caller=index_set.go:422 table-name=netflow_19397 file-name=w73-1666251570274129777-1675943100.gz msg="downloaded file" total_time=90.683853ms
level=info ts=2023-02-16T00:20:37.982355478Z caller=index_set.go:422 table-name=netflow_19397 file-name=w73-1666251570274129777-1675932300.gz msg="downloaded file" total_time=90.906406ms
level=info ts=2023-02-16T00:20:37.983173277Z caller=index_set.go:422 table-name=netflow_19397 file-name=w73-1666251570274129777-1675951200.gz msg="downloaded file" total_time=91.768497ms
level=info ts=2023-02-16T00:20:37.983833829Z caller=index_set.go:422 table-name=netflow_19397 file-name=compactor-1675932489.gz msg="downloaded file" total_time=92.532256ms
level=info ts=2023-02-16T00:20:37.987472253Z caller=index_set.go:422 table-name=netflow_19397 file-name=w73-1666251570274129777-1675958400.gz msg="downloaded file" total_time=96.224117ms
level=error ts=2023-02-16T00:20:42.974030479Z caller=index_set.go:265 table-name=netflow_19397 msg="sync failed, retrying it" err=timeout
level=error ts=2023-02-16T00:20:42.974109059Z caller=index_set.go:104 table-name=netflow_19397 msg="failed to initialize table netflow_19397, cleaning it up" err=timeout
timeout
error creating index client
github.com/grafana/loki/pkg/storage.(*store).storeForPeriod
        /src/loki/pkg/storage/store.go:245
github.com/grafana/loki/pkg/storage.(*store).init
        /src/loki/pkg/storage/store.go:162
github.com/grafana/loki/pkg/storage.NewStore
        /src/loki/pkg/storage/store.go:145
github.com/grafana/loki/pkg/loki.(*Loki).initStore
        /src/loki/pkg/loki/modules.go:522
github.com/grafana/dskit/modules.(*Manager).initModule
        /src/loki/vendor/github.com/grafana/dskit/modules/modules.go:120
github.com/grafana/dskit/modules.(*Manager).InitModuleServices
        /src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92
github.com/grafana/loki/pkg/loki.(*Loki).Run
        /src/loki/pkg/loki/loki.go:341
main.main
        /src/loki/cmd/loki/main.go:105
runtime.main
        /usr/local/go/src/runtime/proc.go:255
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1581
error initialising module: store
github.com/grafana/dskit/modules.(*Manager).initModule
        /src/loki/vendor/github.com/grafana/dskit/modules/modules.go:122
github.com/grafana/dskit/modules.(*Manager).InitModuleServices
        /src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92
github.com/grafana/loki/pkg/loki.(*Loki).Run
        /src/loki/pkg/loki/loki.go:341
main.main
        /src/loki/cmd/loki/main.go:105
runtime.main
        /usr/local/go/src/runtime/proc.go:255
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1581
level=error ts=2023-02-16T00:20:42.980323301Z caller=log.go:103 msg="error running loki" err="timeout\nerror creating index client\ngithub.com/grafana/loki/pkg/storage.(*store).storeForPeriod\n\t/src/loki/pkg/storage/store.go:245\ngithub.com/grafana/loki/pkg/storage.(*store).init\n\t/src/loki/pkg/storage/store.go:162\ngithub.com/grafana/loki/pkg/storage.NewStore\n\t/src/loki/pkg/storage/store.go:145\ngithub.com/grafana/loki/pkg/loki.(*Loki).initStore\n\t/src/loki/pkg/loki/modules.go:522\ngithub.com/grafana/dskit/modules.(*Manager).initModule\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:120\ngithub.com/grafana/dskit/modules.(*Manager).InitModuleServices\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92\ngithub.com/grafana/loki/pkg/loki.(*Loki).Run\n\t/src/loki/pkg/loki/loki.go:341\nmain.main\n\t/src/loki/cmd/loki/main.go:105\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:255\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1581\nerror initialising module: store\ngithub.com/grafana/dskit/modules.(*Manager).initModule\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:122\ngithub.com/grafana/dskit/modules.(*Manager).InitModuleServices\n\t/src/loki/vendor/github.com/grafana/dskit/modules/modules.go:92\ngithub.com/grafana/loki/pkg/loki.(*Loki).Run\n\t/src/loki/pkg/loki/loki.go:341\nmain.main\n\t/src/loki/cmd/loki/main.go:105\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:255\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1581"

仔细看上述该内容,其中第八行显示的是:

level=error ts=2023-02-16T00:20:42.974109059Z caller=index_set.go:104 table-name=netflow_19397 msg="failed to initialize table netflow_19397, cleaning it up" err=timeout

尤其是最后 cleaning it up 既然failed了,那么是否可以人工手动删除呢?

因此笔者直接手动删除该文件,然后再重新启动loki,居然可以了。

汗,具体原因为什么会产生这种问题,还需仔细查找。

你可能感兴趣的:(运维,loki,运维)