• Mesos源码分析(2): Mesos Master的启动之一


    Mesos Master的启动参数如下:

    /usr/sbin/mesos-master --zk=zk://127.0.0.1:2181/mesos --port=5050 --log_dir=/var/log/mesos --hostname=192.168.56.101 --hostname_lookup=false --ip=192.168.56.101 --quorum=1 --registry=replicated_log --work_dir=/var/lib/mesos/master

     

    Mesos Master的启动可以包含很多的参数,参考文档http://mesos.apache.org/documentation/latest/configuration/

     

    Mesos Master的参数可以通过下面两种方式指定:

    • 通过命令行参数:--option_name=value
    • 通过环境变量:MESOS_OPTION_NAME

     

    Mesos Master的启动从代码src/master/main.cpp开始的。

     

    1. master::Flags flags 解析命令行参数和环境变量

     

    1. master::Flags flags;
    2.  
    3. // The following flags are executable specific (e.g., since we only
    4. // have one instance of libprocess per execution, we only want to
    5. // advertise the IP and port option once, here).
    6. Option<string> ip;
    7. flags.add(&ip,
    8.           "ip",
    9.           "IP address to listen on. This cannot be used in conjunction "
    10.           "with `--ip_discovery_command`.");
    11.  
    12. uint16_t port;
    13. flags.add(&port,
    14.           "port",
    15.           "Port to listen on.",
    16.           MasterInfo().port());
    17.  
    18. Option<string> advertise_ip;
    19. flags.add(&advertise_ip,
    20.           "advertise_ip",
    21.           "IP address advertised to reach this Mesos master. "
    22.           "The master does not bind using this IP address. "
    23.           "However, this IP address may be used to access this master.");
    24.  
    25. Option<string> advertise_port;
    26. flags.add(&advertise_port,
    27.           "advertise_port",
    28.           "Port advertised to reach Mesos master (along with "
    29.           "`advertise_ip`). The master does not bind to this port. "
    30.           "However, this port (along with `advertise_ip`) may be used to "
    31.           "access this master.");
    32.  
    33. Option<string> zk;
    34. flags.add(&zk,
    35.           "zk",
    36.           "ZooKeeper URL (used for leader election amongst masters) "
    37.           "May be one of: "
    38.           " `zk://host1:port1,host2:port2,.../path` "
    39.           " `zk://username:password@host1:port1,host2:port2,.../path` "
    40.           " `file:///path/to/file` (where file contains one of the above) "
    41.           "NOTE: Not required if master is run in standalone mode (non-HA).");
    42.  
    43. // Optional IP discover script that will set the Master IP.
    44. // If set, its output is expected to be a valid parseable IP string.
    45. Option<string> ip_discovery_command;
    46. flags.add(&ip_discovery_command,
    47.           "ip_discovery_command",
    48.           "Optional IP discovery binary: if set, it is expected to emit "
    49.           "the IP address which the master will try to bind to. "
    50.           "Cannot be used in conjunction with `--ip`.");

     

    上面便是解析命令行参数的代码。

     

    接下来,需要解析环境变量的参数了。

    1. Try<flags::Warnings> load = flags.load("MESOS_", argc, argv);

     

    那Flags是个什么东西呢,能做这件事情,参考文档https://mesosphere.com/blog/2015/05/14/using-stout-to-parse-command-line-options

     

    Almost every program needs to parse some form of command-line argument. Often, this is a pretty large set of possible options, and the management of the various options is usually pretty tedious while adding virtually no value to the program's functionality.

    Google's gflags are thus a very welcome contribution in that they remove the tediousness. They let program developers give their users a fairly complex set of options to choose from, without wasting time re-inventing the wheel.

    However, the use of macros and certain other quirks within gflags led the team developing Apache Mesos to create a more object-oriented approach to the same problem. This new approach yields a more familiar pattern to the programmer (and those familiar with Python's 'argparse' library will see several similarities there too).

    Stout is a header-only library that can be used independently from Mesos. However, the most up-to-date and recent version should be extracted from the Apache Mesos 3rdparty folder.

    Beyond Flags, Stout offers a wealth of modern abstractions that make coding in C++ a more pleasant experience, especially for folks used to the facilities offered "natively" by other languages such as Scala or Python: 'Try'/'Option' classes (see also below); facilities to deal with Hashmaps; IP/MAC addresses manipulation; the 'Duration' class for time units (which will look very familiar to users of Joda Time) and the nifty 'Stopwatch' utility.

    In the following, we show how to use Stout to simplify management of command-line argument flags, but we invite you to explore the library and find out how it can make your coding life easier.

    Use

    To use Stout_ CLI arguments ("flags") all we have to do is include the header file and derive our custom flags' class from 'FlagsBase.' In 'FlagsXxxx, add the (appropriately typed) fields that will be, at runtime, populated with the correct values from the command line (or the given default values, if any):

    #include <stout/flags/flags.hpp>

    using std::string;

    // Program flags, allows user to run the tests (--test) or the Scheduler

    // against a Mesos Master at --master IP:PORT; or the Executor, which will

    // invoke Mongo using the --config FILE configuration file.

    //

    // All the flags are optional, but at least ONE (and at most one) MUST be

    // present.

    class MongoFlags: public flags::FlagsBase

    {

    public:

    MongoFlags();

    Option<string> master;

    Option<string> config;

    string role;

    bool test;

    };

    In the class's constructor, the actual value of the flag (the '–flag') is defined along with a simple help message and, where necessary, a default value:

    MongoFlags::MongoFlags()

    {

    add(&MongoFlags::master, "master", "The host address of the Mesos Master.");

    add(&MongoFlags::config, "config", "The location of the configuration file,"

    " on the Worker node (this file MUST exist).");

    add(&MongoFlags::role, "role", "The role for the executor", "*");

    add(&MongoFlags::test, "test", "Will only run unit tests and exit.", false);

    }

    One convenient feature is that flags gives you a 'usage()' method that generates a nicely-formatted string that is suitable to be emitted to the user (either upon request, or if something goes wrong):

    void printUsage(const string& prog, const MongoFlags& flags)

    {

    cout << "Usage: " << os::basename(prog).get() << " [options] "

    "One (and only one) of the following options MUST be present. "

    "Options: " << flags.usage() << endl;

    }

    Finally, in your 'main()' you simply call the FlagsBase::load()' method to initialize the class's members, which can then be used as you would normally:

    int main(int argc, char** argv)

    {

    MongoFlags flags;

    bool help;

     

    // flags can be also added outside the Flags class:

    flags.add(&help, "help", "Prints this help message", false);

     

    Try<Nothing> load = flags.load(None(), argc, argv);

     

    if (load.isError()) {

    std::cerr << "Failed to load flags: " << load.error() << std::endl;

    return -1;

    }

     

    if (!help) {

    if (flags.test) {

    cout << "Running unit tests for Playground App ";

    return test(argc, argv);

    }

    if (flags.config.isSome()) {

    return run_executor(flags.config.get());

    }

     

    if (flags.master.isSome()) {

    string uri = os::realpath(argv[0]).get();

    auto masterIp = flags.master.get();

    cout << "MongoExecutor starting - launching Scheduler rev. "

    << MongoScheduler::REV << " starting Executor at: " << uri << ' ';

    return run_scheduler(uri, masterIp);

    }

    }

    printUsage(argv[0], flags);

    }

    For a full-fledged (and extensive) use of 'stout/flags,' see the 'master.cpp and associated header file in the 'src/master' folder of the Apache Mesos repo.

    Optional Values

    Optional arguments can be wrapped in Stout's 'Option type, which is an extremely convenient abstraction of objects that may optionally be unassigned. That means circumventing all the awkwardness of using 'NULL' — which, in fact, you should avoid at all costs in your code.

    The customary pattern of usage for an 'Option' object is exemplified in the snippet:

    void doSomething(const std::string& widget) {

    // as far as this method is concerned, strings are all there is

    // ...

    }

     

    // in another part of your program

     

    Option<std::string> foo;

     

    // other code that may (or may not) set foo to some value

     

    if (foo.isSome()) {

    doSomething(foo.get());

    }

    Again, more examples can be found in several places in the source code of Mesos (see, for example, 'main.cpp' in the same source folder as above).

     

    Mesos就是封装了Google的gflags来解析命令行参数和环境变量

     

    在src/master/flags.cpp里面下面的代码:

    1. mesos::internal::master::Flags::Flags()
    2. {
    3.   add(&Flags::version,
    4.       "version",
    5.       "Show version and exit.",
    6.       false);
    7.  
    8.   add(&Flags::hostname,
    9.       "hostname",
    10.       "The hostname the master should advertise in ZooKeeper. "
    11.       "If left unset, the hostname is resolved from the IP address "
    12.       "that the agent binds to; unless the user explicitly prevents "
    13.       "that, using `--no-hostname_lookup`, in which case the IP itself "
    14.       "is used.");
    15.  
    16.   add(&Flags::hostname_lookup,
    17.       "hostname_lookup",
    18.       "Whether we should execute a lookup to find out the server's hostname, "
    19.       "if not explicitly set (via, e.g., `--hostname`). "
    20.       "True by default; if set to `false` it will cause Mesos "
    21.       "to use the IP address, unless the hostname is explicitly set.",
    22.       true);
    23.  
    24.   add(&Flags::root_submissions,
    25.       "root_submissions",
    26.       "Can root submit frameworks?",
    27.       true);
    28.  
    29.   add(&Flags::work_dir,
    30.       "work_dir",
    31.       "Path of the master work directory. This is where the persistent "
    32.       "information of the cluster will be stored. Note that locations like "
    33.       "`/tmp` which are cleaned automatically are not suitable for the work "
    34.       "directory when running in production, since long-running masters could "
    35.       "lose data when cleanup occurs. (Example: `/var/lib/mesos/master`)");
    36.  
    37.   // TODO(bmahler): Consider removing `in_memory` as it was only
    38.   // used before `replicated_log` was implemented.
    39.   add(&Flags::registry,
    40.       "registry",
    41.       "Persistence strategy for the registry; "
    42.       "available options are `replicated_log`, `in_memory` (for testing).",
    43.       "replicated_log");
    44.  
    45.   // TODO(vinod): Instead of specifying the quorum size consider
    46.   // specifying the number of masters or the list of masters.
    47.   add(&Flags::quorum,
    48.       "quorum",
    49.       "The size of the quorum of replicas when using `replicated_log` based "
    50.       "registry. It is imperative to set this value to be a majority of "
    51.       "masters i.e., `quorum > (number of masters)/2`. "
    52.       "NOTE: Not required if master is run in standalone mode (non-HA).");
    53.  
    54.   add(&Flags::zk_session_timeout,
    55.       "zk_session_timeout",
    56.       "ZooKeeper session timeout.",
    57.       ZOOKEEPER_SESSION_TIMEOUT);
    58.  
    59.   // TODO(bmahler): Set the default to true in 0.20.0.
    60.   add(&Flags::registry_strict,
    61.       "registry_strict",
    62.       "Whether the master will take actions based on the persistent "
    63.       "information stored in the Registry. Setting this to false means "
    64.       "that the Registrar will never reject the admission, readmission, "
    65.       "or removal of an agent. Consequently, `false` can be used to "
    66.       "bootstrap the persistent state on a running cluster. "
    67.       "NOTE: This flag is *experimental* and should not be used in "
    68.       "production yet.",
    69.       false);
    70.  
    71.   add(&Flags::registry_fetch_timeout,
    72.       "registry_fetch_timeout",
    73.       "Duration of time to wait in order to fetch data from the registry "
    74.       "after which the operation is considered a failure.",
    75.       Seconds(60));
    76.  
    77.   add(&Flags::registry_store_timeout,
    78.       "registry_store_timeout",
    79.       "Duration of time to wait in order to store data in the registry "
    80.       "after which the operation is considered a failure.",
    81.       Seconds(20));
    82.  
    83.   add(&Flags::log_auto_initialize,
    84.       "log_auto_initialize",
    85.       "Whether to automatically initialize the replicated log used for the "
    86.       "registry. If this is set to false, the log has to be manually "
    87.       "initialized when used for the very first time.",
    88.       true);
    89.  
    90.   add(&Flags::agent_reregister_timeout,
    91.       "agent_reregister_timeout",
    92.       flags::DeprecatedName("slave_reregister_timeout"),
    93.       "The timeout within which all agents are expected to re-register "
    94.       "when a new master is elected as the leader. Agents that do not "
    95.       "re-register within the timeout will be removed from the registry "
    96.       "and will be shutdown if they attempt to communicate with master. "
    97.       "NOTE: This value has to be at least " +
    98.         stringify(MIN_AGENT_REREGISTER_TIMEOUT) + ".",
    99.       MIN_AGENT_REREGISTER_TIMEOUT);
    100.  
    101.   // TODO(bmahler): Add a `Percentage` abstraction for flags.
    102.   // TODO(bmahler): Add a `--production` flag for production defaults.
    103.   add(&Flags::recovery_agent_removal_limit,
    104.       "recovery_agent_removal_limit",
    105.       flags::DeprecatedName("recovery_slave_removal_limit"),
    106.       "For failovers, limit on the percentage of agents that can be removed "
    107.       "from the registry *and* shutdown after the re-registration timeout "
    108.       "elapses. If the limit is exceeded, the master will fail over rather "
    109.       "than remove the agents. "
    110.       "This can be used to provide safety guarantees for production "
    111.       "environments. Production environments may expect that across master "
    112.       "failovers, at most a certain percentage of agents will fail "
    113.       "permanently (e.g. due to rack-level failures). "
    114.       "Setting this limit would ensure that a human needs to get "
    115.       "involved should an unexpected widespread failure of agents occur "
    116.       "in the cluster. "
    117.       "Values: [0%-100%]",
    118.       stringify(RECOVERY_AGENT_REMOVAL_PERCENT_LIMIT * 100.0) + "%");
    119.  
    120.   // TODO(vinod): Add a `Rate` abstraction in stout and the
    121.   // corresponding parser for flags.
    122.   add(&Flags::agent_removal_rate_limit,
    123.       "agent_removal_rate_limit",
    124.       flags::DeprecatedName("slave_removal_rate_limit"),
    125.       "The maximum rate (e.g., `1/10mins`, `2/3hrs`, etc) at which agents "
    126.       "will be removed from the master when they fail health checks. "
    127.       "By default, agents will be removed as soon as they fail the health "
    128.       "checks. The value is of the form `(Number of agents)/(Duration)`.");
    129.  
    130.   add(&Flags::webui_dir,
    131.       "webui_dir",
    132.       "Directory path of the webui files/assets",
    133.       PKGDATADIR "/webui");
    134.  
    135.   add(&Flags::whitelist,
    136.       "whitelist",
    137.       "Path to a file which contains a list of agents (one per line) to "
    138.       "advertise offers for. The file is watched, and periodically re-read to "
    139.       "refresh the agent whitelist. By default there is no whitelist / all "
    140.       "machines are accepted. Path could be of the form "
    141.       "`file:///path/to/file` or `/path/to/file`. ");
    142.  
    143.   add(&Flags::user_sorter,
    144.       "user_sorter",
    145.       "Policy to use for allocating resources "
    146.       "between users. May be one of: "
    147.       " dominant_resource_fairness (drf)",
    148.       "drf");
    149.  
    150.   add(&Flags::framework_sorter,
    151.       "framework_sorter",
    152.       "Policy to use for allocating resources "
    153.       "between a given user's frameworks. Options "
    154.       "are the same as for user_allocator.",
    155.       "drf");
    156.  
    157.   add(&Flags::allocation_interval,
    158.       "allocation_interval",
    159.       "Amount of time to wait between performing "
    160.       " (batch) allocations (e.g., 500ms, 1sec, etc).",
    161.       DEFAULT_ALLOCATION_INTERVAL);
    162.  
    163.   add(&Flags::cluster,
    164.       "cluster",
    165.       "Human readable name for the cluster, displayed in the webui.");
    166.  
    167.   add(&Flags::roles,
    168.       "roles",
    169.       "A comma-separated list of the allocation roles that frameworks "
    170.       "in this cluster may belong to. This flag is deprecated; "
    171.       "if it is not specified, any role name can be used.");
    172.  
    173.   add(&Flags::weights,
    174.       "weights",
    175.       "A comma-separated list of role/weight pairs of the form "
    176.       "`role=weight,role=weight`. Weights can be used to control the "
    177.       "relative share of cluster resources that is offered to different "
    178.       "roles. This flag is deprecated. Instead, operators should configure "
    179.       "weights dynamically using the `/weights` HTTP endpoint.");
    180.  
    181.   // TODO(adam-mesos): Deprecate --authenticate for --authenticate_frameworks.
    182.   // See MESOS-4386 for details.
    183.   add(&Flags::authenticate_frameworks,
    184.       "authenticate_frameworks",
    185.       flags::DeprecatedName("authenticate"),
    186.       "If `true`, only authenticated frameworks are allowed to register. If "
    187.       "`false`, unauthenticated frameworks are also allowed to register. For "
    188.       "HTTP based frameworks use the `--authenticate_http_frameworks` flag.",
    189.       false);
    190.  
    191.   add(&Flags::authenticate_agents,
    192.       "authenticate_agents",
    193.       flags::DeprecatedName("authenticate_slaves"),
    194.       "If `true`, only authenticated agents are allowed to register. "
    195.       "If `false`, unauthenticated agents are also allowed to register.",
    196.       false);
    197.  
    198.   add(&Flags::authenticate_http,
    199.       "authenticate_http",
    200.       "If `true`, only authenticated requests for HTTP endpoints supporting "
    201.       "authentication are allowed. If `false`, unauthenticated requests to "
    202.       "HTTP endpoints are also allowed. ",
    203.       false);
    204.  
    205.   add(&Flags::authenticate_http_frameworks,
    206.       "authenticate_http_frameworks",
    207.       "If `true`, only authenticated HTTP frameworks are allowed to register. "
    208.       "If `false`, HTTP frameworks are not authenticated.",
    209.       false);
    210.  
    211.   add(&Flags::credentials,
    212.       "credentials",
    213.       "Path to a JSON-formatted file containing credentials. "
    214.       "Path could be of the form `file:///path/to/file` or `/path/to/file`."
    215.       " "
    216.       "Example: "
    217.       "{ "
    218.       " "credentials": [ "
    219.       " { "
    220.       " "principal": "sherman", "
    221.       " "secret": "kitesurf" "
    222.       " } "
    223.       " ] "
    224.       "}");
    225.  
    226.   add(&Flags::acls,
    227.       "acls",
    228.       "The value could be a JSON-formatted string of ACLs "
    229.       "or a file path containing the JSON-formatted ACLs used "
    230.       "for authorization. Path could be of the form `file:///path/to/file` "
    231.       "or `/path/to/file`. "
    232.       " "
    233.       "Note that if the flag `--authorizers` is provided with a value "
    234.       "different than `" + string(DEFAULT_AUTHORIZER) + "`, the ACLs contents "
    235.       "will be ignored. "
    236.       " "
    237.       "See the ACLs protobuf in acls.proto for the expected format. "
    238.       " "
    239.       "Example: "
    240.       "{ "
    241.       " "register_frameworks": [ "
    242.       " { "
    243.       " "principals": { "type": "ANY" }, "
    244.       " "roles": { "values": ["a"] } "
    245.       " } "
    246.       " ], "
    247.       " "run_tasks": [ "
    248.       " { "
    249.       " "principals": { "values": ["a", "b"] }, "
    250.       " "users": { "values": ["c"] } "
    251.       " } "
    252.       " ], "
    253.       " "teardown_frameworks": [ "
    254.       " { "
    255.       " "principals": { "values": ["a", "b"] }, "
    256.       " "framework_principals": { "values": ["c"] } "
    257.       " } "
    258.       " ], "
    259.       " "set_quotas": [ "
    260.       " { "
    261.       " "principals": { "values": ["a"] }, "
    262.       " "roles": { "values": ["a", "b"] } "
    263.       " } "
    264.       " ], "
    265.       " "remove_quotas": [ "
    266.       " { "
    267.       " "principals": { "values": ["a"] }, "
    268.       " "quota_principals": { "values": ["a"] } "
    269.       " } "
    270.       " ] "
    271.       "}");
    272.  
    273.   add(&Flags::firewall_rules,
    274.       "firewall_rules",
    275.       "The value could be a JSON-formatted string of rules or a "
    276.       "file path containing the JSON-formatted rules used in the endpoints "
    277.       "firewall. Path must be of the form `file:///path/to/file` "
    278.       "or `/path/to/file`. "
    279.       " "
    280.       "See the `Firewall` message in `flags.proto` for the expected format. "
    281.       " "
    282.       "Example: "
    283.       "{ "
    284.       " "disabled_endpoints" : { "
    285.       " "paths" : [ "
    286.       " "/files/browse", "
    287.       " "/metrics/snapshot" "
    288.       " ] "
    289.       " } "
    290.       "}");
    291.  
    292.   add(&Flags::rate_limits,
    293.       "rate_limits",
    294.       "The value could be a JSON-formatted string of rate limits "
    295.       "or a file path containing the JSON-formatted rate limits used "
    296.       "for framework rate limiting. "
    297.       "Path could be of the form `file:///path/to/file` "
    298.       "or `/path/to/file`. "
    299.       " "
    300.       "See the RateLimits protobuf in mesos.proto for the expected format. "
    301.       " "
    302.       "Example: "
    303.       "{ "
    304.       " "limits": [ "
    305.       " { "
    306.       " "principal": "foo", "
    307.       " "qps": 55.5 "
    308.       " }, "
    309.       " { "
    310.       " "principal": "bar" "
    311.       " } "
    312.       " ], "
    313.       " "aggregate_default_qps": 33.3 "
    314.       "}");
    315.  
    316. #ifdef WITH_NETWORK_ISOLATOR
    317.   add(&Flags::max_executors_per_agent,
    318.       "max_executors_per_agent",
    319.       flags::DeprecatedName("max_executors_per_slave"),
    320.       "Maximum number of executors allowed per agent. The network "
    321.       "monitoring/isolation technique imposes an implicit resource "
    322.       "acquisition on each executor (# ephemeral ports), as a result "
    323.       "one can only run a certain number of executors on each agent.");
    324. #endif // WITH_NETWORK_ISOLATOR
    325.  
    326.   // TODO(karya): When we have optimistic offers, this will only
    327.   // benefit frameworks that accidentally lose an offer.
    328.   add(&Flags::offer_timeout,
    329.       "offer_timeout",
    330.       "Duration of time before an offer is rescinded from a framework. "
    331.       "This helps fairness when running frameworks that hold on to offers, "
    332.       "or frameworks that accidentally drop offers. "
    333.       "If not set, offers do not timeout.");
    334.  
    335.   // This help message for --modules flag is the same for
    336.   // {master,slave,sched,tests}/flags.[ch]pp and should always be kept in
    337.   // sync.
    338.   // TODO(karya): Remove the JSON example and add reference to the
    339.   // doc file explaining the --modules flag.
    340.   add(&Flags::modules,
    341.       "modules",
    342.       "List of modules to be loaded and be available to the internal "
    343.       "subsystems. "
    344.       " "
    345.       "Use `--modules=filepath` to specify the list of modules via a "
    346.       "file containing a JSON-formatted string. `filepath` can be "
    347.       "of the form `file:///path/to/file` or `/path/to/file`. "
    348.       " "
    349.       "Use `--modules="{...}"` to specify the list of modules inline. "
    350.       " "
    351.       "Example: "
    352.       "{ "
    353.       " "libraries": [ "
    354.       " { "
    355.       " "file": "/path/to/libfoo.so", "
    356.       " "modules": [ "
    357.       " { "
    358.       " "name": "org_apache_mesos_bar", "
    359.       " "parameters": [ "
    360.       " { "
    361.       " "key": "X", "
    362.       " "value": "Y" "
    363.       " } "
    364.       " ] "
    365.       " }, "
    366.       " { "
    367.       " "name": "org_apache_mesos_baz" "
    368.       " } "
    369.       " ] "
    370.       " }, "
    371.       " { "
    372.       " "name": "qux", "
    373.       " "modules": [ "
    374.       " { "
    375.       " "name": "org_apache_mesos_norf" "
    376.       " } "
    377.       " ] "
    378.       " } "
    379.       " ] "
    380.       "} "
    381.       "Cannot be used in conjunction with --modules_dir. ");
    382.  
    383.   // This help message for --modules_dir flag is the same for
    384.   // {master,slave,sched,tests}/flags.[ch]pp and should always be kept in
    385.   // sync.
    386.   add(&Flags::modulesDir,
    387.       "modules_dir",
    388.       "Directory path of the module manifest files. "
    389.       "The manifest files are processed in alphabetical order. "
    390.       "(See --modules for more information on module manifest files) "
    391.       "Cannot be used in conjunction with --modules. ");
    392.  
    393.   add(&Flags::authenticators,
    394.       "authenticators",
    395.       "Authenticator implementation to use when authenticating frameworks "
    396.       "and/or agents. Use the default `" + string(DEFAULT_AUTHENTICATOR) + "` "
    397.       "or load an alternate authenticator module using `--modules`.",
    398.       DEFAULT_AUTHENTICATOR);
    399.  
    400.   add(&Flags::allocator,
    401.       "allocator",
    402.       "Allocator to use for resource allocation to frameworks. "
    403.       "Use the default `" + string(DEFAULT_ALLOCATOR) + "` allocator, or "
    404.       "load an alternate allocator module using `--modules`.",
    405.       DEFAULT_ALLOCATOR);
    406.  
    407.   add(&Flags::fair_sharing_excluded_resource_names,
    408.       "fair_sharing_excluded_resource_names",
    409.       "A comma-separated list of the resource names (e.g. 'gpus') "
    410.       "that will be excluded from fair sharing constraints. "
    411.       "This may be useful in cases where the fair sharing "
    412.       "implementation currently has limitations. E.g. See the "
    413.       "problem of "scarce" resources: "
    414.       " http://www.mail-archive.com/dev@mesos.apache.org/msg35631.html "
    415.       " https://issues.apache.org/jira/browse/MESOS-5377");
    416.  
    417.   add(&Flags::hooks,
    418.       "hooks",
    419.       "A comma-separated list of hook modules to be "
    420.       "installed inside master.");
    421.  
    422.   add(&Flags::agent_ping_timeout,
    423.       "agent_ping_timeout",
    424.       flags::DeprecatedName("slave_ping_timeout"),
    425.       "The timeout within which each agent is expected to respond to a "
    426.       "ping from the master. Agents that do not respond within "
    427.       "max_agent_ping_timeouts ping retries will be asked to shutdown. "
    428.       "NOTE: The total ping timeout (`agent_ping_timeout` multiplied by "
    429.       "`max_agent_ping_timeouts`) should be greater than the ZooKeeper "
    430.       "session timeout to prevent useless re-registration attempts. ",
    431.       DEFAULT_AGENT_PING_TIMEOUT,
    432.       [](const Duration& value) -> Option<Error> {
    433.         if (value < Seconds(1) || value > Minutes(15)) {
    434.           return Error("Expected `--agent_ping_timeout` to be between " +
    435.                        stringify(Seconds(1)) + " and " +
    436.                        stringify(Minutes(15)));
    437.         }
    438.         return None();
    439.       });
    440.  
    441.   add(&Flags::max_agent_ping_timeouts,
    442.       "max_agent_ping_timeouts",
    443.       flags::DeprecatedName("max_slave_ping_timeouts"),
    444.       "The number of times an agent can fail to respond to a "
    445.       "ping from the master. Agents that do not respond within "
    446.       "`max_agent_ping_timeouts` ping retries will be asked to shutdown. ",
    447.       DEFAULT_MAX_AGENT_PING_TIMEOUTS,
    448.       [](size_t value) -> Option<Error> {
    449.         if (value < 1) {
    450.           return Error("Expected `--max_agent_ping_timeouts` to be at least 1");
    451.         }
    452.         return None();
    453.       });
    454.  
    455.   add(&Flags::authorizers,
    456.       "authorizers",
    457.       "Authorizer implementation to use when authorizing actions that "
    458.       "require it. "
    459.       "Use the default `" + string(DEFAULT_AUTHORIZER) + "`, or "
    460.       "load an alternate authorizer module using `--modules`. "
    461.       " "
    462.       "Note that if the flag `--authorizers` is provided with a value "
    463.       "different than the default `" + string(DEFAULT_AUTHORIZER) + "`, the "
    464.       "ACLs passed through the `--acls` flag will be ignored. "
    465.       " "
    466.       "Currently there's no support for multiple authorizers.",
    467.       DEFAULT_AUTHORIZER);
    468.  
    469.   add(&Flags::http_authenticators,
    470.       "http_authenticators",
    471.       "HTTP authenticator implementation to use when handling requests to "
    472.       "authenticated endpoints. Use the default "
    473.       "`" + string(DEFAULT_HTTP_AUTHENTICATOR) + "`, or load an alternate "
    474.       "HTTP authenticator module using `--modules`. "
    475.       " "
    476.       "Currently there is no support for multiple HTTP authenticators.",
    477.       DEFAULT_HTTP_AUTHENTICATOR);
    478.  
    479.   add(&Flags::http_framework_authenticators,
    480.       "http_framework_authenticators",
    481.       "HTTP authenticator implementation to use when authenticating HTTP "
    482.       "frameworks. Use the "
    483.       "`" + string(DEFAULT_HTTP_AUTHENTICATOR) + "` authenticator or load an "
    484.       "alternate authenticator module using `--modules`. "
    485.       "Must be used in conjunction with `--http_authenticate_frameworks`. "
    486.       " "
    487.       "Currently there is no support for multiple HTTP framework "
    488.       "authenticators.");
    489.  
    490.   add(&Flags::max_completed_frameworks,
    491.       "max_completed_frameworks",
    492.       "Maximum number of completed frameworks to store in memory.",
    493.       DEFAULT_MAX_COMPLETED_FRAMEWORKS);
    494.  
    495.   add(&Flags::max_completed_tasks_per_framework,
    496.       "max_completed_tasks_per_framework",
    497.       "Maximum number of completed tasks per framework to store in memory.",
    498.       DEFAULT_MAX_COMPLETED_TASKS_PER_FRAMEWORK);
    499.  
    500.   add(&Flags::master_contender,
    501.       "master_contender",
    502.       "The symbol name of the master contender to use. "
    503.       "This symbol should exist in a module specified through "
    504.       "the --modules flag. Cannot be used in conjunction with --zk. "
    505.       "Must be used in conjunction with --master_detector.");
    506.  
    507.   add(&Flags::master_detector,
    508.       "master_detector",
    509.       "The symbol name of the master detector to use. This symbol "
    510.       "should exist in a module specified through the --modules flag. "
    511.       "Cannot be used in conjunction with --zk. "
    512.       "Must be used in conjunction with --master_contender.");
    513. }

     

    里面的参数和http://mesos.apache.org/documentation/latest/configuration/中的参数列表一模一样。

     

  • 相关阅读:
    《Apache Doris在美团外卖数仓中的应用实践》
    《一文教会你如何写复杂业务的代码》
    《SOFA企业应用框架》
    《为什么阿里巴巴代码规约要求避免使用 Apache BeanUtils 进行属性的拷贝》
    《浅析VO、DTO、DO、PO的概念、区别和用处》
    Spring 注解
    《浅析VO、DTO、DO、PO的概念、区别和用处》
    dsgn_ebook
    《清华大学刘世霞“可解释机器学习的可视化分析”(附PPT)》
    《图结构的相似度度量与分类》
  • 原文地址:https://www.cnblogs.com/popsuper1982/p/5700132.html
Copyright © 2020-2023  润新知