XRAY: How to fix Error- Failed to get binary manager id
When trying to install Xray the logs display the error:
Failed to get binary manager id
followed by other errors relating to failing around the binary manager.
This leads to a warning relating to Missing required services and failed heartbeat, as printed below:
Missing required services : [jfxr jfxidx jfxana jfxpst jfob], periodic send heartbeat failed for X consecutive times. Last error: failed sending heartbeat information to Access: failed closing Access grpc client: rpc error: code = Unavailable desc = Service Unavailable: HTTP status code 503; transport: missing content-type field
Service registry ping failed, will retry. Error: Error while trying to connect to the local router at address 'http://localhost:8046/access': Failed to access: http://localhost:8046/access/api/v1/system/ping return status code : 503
and Xray fails to start.
On initial startup, Xray reaches out to Artifactory through the configured JFrogURL in the Xray system.yaml. During this initial connection, Artifactory shares its direct IP and port for Xray to use in future communication. This is why it is important for Xray and Artifactory to be on the same internal network and the IP and port 8082 to be open for this direct communication.
Artifactory provides the IP based on what is configured in shared.node.ip or what was auto-detected on startup (if shared.node.ip is not set) . Especially for Docker environments, this internal IP could be an internal Docker IP that is not reachable outside of the container; this is why setting the external IP for these setups is so important.
The error 'Failed to get binary manager id' means that Xray tried to reach Artifactory through this IP, but the request didn't reach Artifactory. This then causes the subsequent errors
This could be because of a few reasons:
- it has been manually set incorrectly
- the system.yaml spacing is incorrect,
- Because the automatic resolution of this internal ip did not run correctly on the startup of Artifactory.
ResolutionEdit the Artifactory system.yaml shared.node.ip attribute.
The Artifactory system.yaml file can be found here: $JFROG_HOME/artifactory/var/etc
and an example system.yaml file can be found here.
Add the internal ip even if there is nothing configured currently, as it could be the automatic resolution of the Artifactory ip did not work.
YAML files are whitespace dependent so it is imperative you ensure the attributes are spaced correctly and not tabbed.
shared: node: ip: xxx.xxx.xxx (replace with internal ip of machine artifactory is running on)
Shared should be at the base of the file with no space before it. The node should be spaced inside of shared and ip should be spaced inside of node. See here for the full system.YAML example.
After making the changes, restart Artifactory and then Xray.