今天我們通過(guò)閱讀Flume-NG的源碼來(lái)看看Flume的整個(gè)啟動(dòng)流程,廢話不多說(shuō),翠花,上源碼!!
1 主類也是啟動(dòng)類
在這里我貼出Application中跟啟動(dòng)有關(guān)的方法,其他你們可以自己看源碼,畢竟源碼解析解的是思路。
org.apache.flume.node.Application
/*主函數(shù)*/ public static void main(String[] args) { try { boolean isZkConfigured = false; Options options = new Options(); Option option = new Option("n", "name", true, "the name of this agent"); option.setRequired(true); options.addOption(option); option = new Option("f", "conf-file", true, "specify a config file (required if -z missing)"); option.setRequired(false); options.addOption(option); option = new Option(null, "no-reload-conf", false, "do not reload config file if changed");