cluster.settings


  • <Object>
    • execArgv <string[]> 传给 Node.js 可执行文件的字符串参数列表。 默认值: process.execArgv
    • exec <string> 工作进程文件的文件路径。 默认值: process.argv[1]
    • args <string[]> 传给工作进程的字符串参数。 默认值: process.argv.slice(2)
    • cwd <string> 工作进程的当前工作目录。 默认值: undefined (从父进程继承)。
    • serialization <string> 指定用于在进程之间发送消息的序列化类型。 可能的值为 'json''advanced'。 有关更多详细信息,请参阅子进程的高级序列化默认值: false
    • silent <boolean> 是否将输出发送到父进程的标准输入输出。 默认值: false
    • stdio <Array> 配置衍生进程的标准输入输出。 由于集群模块依赖 IPC 来运行,因此此配置必须包含 'ipc' 条目。 提供此选项时,它会覆盖 silent
    • uid <number> 设置进程的用户标识。 (见 setuid(2)。)
    • gid <number> 设置进程的群组标识。 (见 setgid(2)。)
    • inspectPort <number> | <Function> 设置工作进程的检查器端口。 这可以是数字,也可以是不带参数并返回数字的函数。 默认情况下,每个工作进程都有自己的端口,从主进程的 process.debugPort 开始递增。
    • windowsHide <boolean> 隐藏通常在 Windows 系统上创建的衍生进程控制台窗口。 默认值: false

调用 .setupPrimary()(或 .fork())之后,此设置对象将包含设置,包括默认值。

此对象不应手动更改或设置。

  • <Object>
    • execArgv <string[]> List of string arguments passed to the Node.js executable. Default: process.execArgv.
    • exec <string> File path to worker file. Default: process.argv[1].
    • args <string[]> String arguments passed to worker. Default: process.argv.slice(2).
    • cwd <string> Current working directory of the worker process. Default: undefined (inherits from parent process).
    • serialization <string> Specify the kind of serialization used for sending messages between processes. Possible values are 'json' and 'advanced'. See Advanced serialization for child_process for more details. Default: false.
    • silent <boolean> Whether or not to send output to parent's stdio. Default: false.
    • stdio <Array> Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must contain an 'ipc' entry. When this option is provided, it overrides silent.
    • uid <number> Sets the user identity of the process. (See setuid(2).)
    • gid <number> Sets the group identity of the process. (See setgid(2).)
    • inspectPort <number> | <Function> Sets inspector port of worker. This can be a number, or a function that takes no arguments and returns a number. By default each worker gets its own port, incremented from the primary's process.debugPort.
    • windowsHide <boolean> Hide the forked processes console window that would normally be created on Windows systems. Default: false.

After calling .setupPrimary() (or .fork()) this settings object will contain the settings, including the default values.

This object is not intended to be changed or set manually.