'Unable to perform an operation on node rabbitmq

Trying to set up a rabbitmq with rabbit@localhost, but:

c:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.18\sbin>rabbitmqctl status
Error: unable to perform an operation on node 'rabbit@localhost'. Please see diagnostics information and suggestions below.

Erlang + Rabbitmq + Win7. I've started Rabbitmq service, it works, but nodes are created automatically with random names

attempted to contact: [rabbit@localhost]

rabbit@localhost:
  * connected to epmd (port 4369) on localhost
  * epmd reports: node 'rabbit' not running at all
                  no other nodes on localhost
  * suggestion: start the node

Current node details:
 * node name: 'rabbitmqcli-10012-rabbit@localhost'
 * effective user's home directory: C:\Users\andrey
 * Erlang cookie hash: LdQNaRpK/HR5vh8yRc6A2w==


Solution 1:[1]

Next steps solved my problem:

0)add set RABBITMQ_NODENAME=rabbit@localhost in rabbitmq-env.bat

1)rabbitmq.conf and rabbitmq-env.conf was different. But shoud be the same:

CONFIG_FILE=C:\Users\<youruser>\AppData\Roaming\RabbitMQ\rabbitmq
NODE_IP_ADDRESS=127.0.0.1
NODENAME=rabbit@localhost

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 alienless Andrey