Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复filebeat registry持续增长不释放的问题 #253 #286

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yuline
Copy link

@yuline yuline commented May 9, 2020

issue:#253

yuline added 3 commits May 9, 2020 12:11
Signed-off-by: yul <yl000111@126.com>
Signed-off-by: yul <yl000111@126.com>
@silenceper
Copy link

silenceper commented May 14, 2020

有个疑问,state信息放在了filebeat内存中,通过ioutil.WriteFile(FILEBEAT_REGISTRY, nb, 0600)能成功吗?

不会在filebeat自身调用func (r *Registrar) flushRegistry() {的时候覆盖吗?

@silenceper
Copy link

silenceper commented May 14, 2020

https://github.com/elastic/beats/blob/master/filebeat/registrar/registrar.go#L372-L408

func (r *Registrar) flushRegistry() {
	if err := r.writeRegistry(); err != nil {
		logp.Err("Writing of registry returned error: %v. Continuing...", err)
	}


	if r.out != nil {
		r.out.Published(r.bufferedStateUpdates)
	}
	r.bufferedStateUpdates = 0
}


// writeRegistry writes the new json registry file to disk.
func (r *Registrar) writeRegistry() error {
	// First clean up states
	r.gcStates()
	states := r.states.GetStates()
	statesCurrent.Set(int64(len(states)))


	registryWrites.Inc()


	tempfile, err := writeTmpFile(r.registryFile, r.fileMode, states)
	if err != nil {
		registryFails.Inc()
		return err
	}


	err = helper.SafeFileRotate(r.registryFile, tempfile)
	if err != nil {
		registryFails.Inc()
		return err
	}


	logp.Debug("registrar", "Registry file updated. %d states written.", len(states))
	registrySuccess.Inc()


	return nil
}

如果是这样的话,我想到的办法是改filebeat代码,去处理不存在文件的state。

@yuline
Copy link
Author

yuline commented May 15, 2020

有个疑问,state信息放在了filebeat内存中,通过ioutil.WriteFile(FILEBEAT_REGISTRY, nb, 0600)能成功吗?

不会在filebeat自身调用func (r *Registrar) flushRegistry() {的时候覆盖吗?

在重写registry前停止filebeat,重写后启动filebeat :)

// 对filebeat进行container释放清理操作
p.Stop()   //停止filebeat
<-p.fbExit //等待filebeat退出
defer func() {
	time.Sleep(2 * time.Second)
	p.Start()
	time.Sleep(2 * time.Second)
}()

@yuline
Copy link
Author

yuline commented Jun 15, 2020

请问一下,这个改动是否在生产环境上跑起来了?我这边想把这个改动加上去

恩,已经在生产环境运行了四五个月了

@life123
Copy link

life123 commented Jun 15, 2020

请问一下,这个改动是否在生产环境上跑起来了?我这边想把这个改动加上去

恩,已经在生产环境运行了四五个月了

还有哦
1,用的FILEBEAT_VERSION是否也是6.1.1-3?也就是是否升级了filebeat
2,filebeat.tpl和conf.filebeat里的配置是否有做哪些优化改动?
我这边在测试上也跑了几天,正在考虑还有哪些需要优化的地方,再切到生产

@totemofwolf
Copy link

请问一下,这个改动是否在生产环境上跑起来了?我这边想把这个改动加上去

恩,已经在生产环境运行了四五个月了

阿里是不是自己魔改了 filebeat-6.1.1-3 ?我尝试使用 elasitc官方的 filebeat 发现无法自动按照业务创建索引。。

@yuline
Copy link
Author

yuline commented Jul 5, 2020

请问一下,这个改动是否在生产环境上跑起来了?我这边想把这个改动加上去

恩,已经在生产环境运行了四五个月了

还有哦
1,用的FILEBEAT_VERSION是否也是6.1.1-3?也就是是否升级了filebeat
2,filebeat.tpl和conf.filebeat里的配置是否有做哪些优化改动?
我这边在测试上也跑了几天,正在考虑还有哪些需要优化的地方,再切到生产

我们没有改动filebeat版本和其他配置。

@yuline
Copy link
Author

yuline commented Aug 13, 2020

请问一下,这个改动是否在生产环境上跑起来了?我这边想把这个改动加上去

恩,已经在生产环境运行了四五个月了

阿里是不是自己魔改了 filebeat-6.1.1-3 ?我尝试使用 elasitc官方的 filebeat 发现无法自动按照业务创建索引。。

索引是logstash创建的吧。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants