+
This commit is contained in:
9
.idea/Ubuntu.iml
generated
Normal file
9
.idea/Ubuntu.iml
generated
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
6
.idea/misc.xml
generated
Normal file
6
.idea/misc.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/Ubuntu.iml" filepath="$PROJECT_DIR$/.idea/Ubuntu.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
69
.idea/workspace.xml
generated
Normal file
69
.idea/workspace.xml
generated
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AutoImportSettings">
|
||||||
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
|
</component>
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" id="e1fbeaad-6efe-4e4e-9cc3-db157d3cbbd0" name="Changes" comment="" />
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="Git.Settings">
|
||||||
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectColorInfo">{
|
||||||
|
"associatedIndex": 2
|
||||||
|
}</component>
|
||||||
|
<component name="ProjectId" id="2t3w0yc2N4mk67dYNBrpPZpSXiI" />
|
||||||
|
<component name="ProjectViewState">
|
||||||
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
|
<option name="showLibraryContents" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
|
"keyToString": {
|
||||||
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
|
"RunOnceActivity.git.unshallow": "true",
|
||||||
|
"git-widget-placeholder": "master",
|
||||||
|
"ignore.virus.scanning.warn.message": "true",
|
||||||
|
"kotlin-language-version-configured": "true",
|
||||||
|
"last_opened_file_path": "O:/MyDocuments/projects/Workspace_JavaWin/org.ccalm.jwt",
|
||||||
|
"node.js.detected.package.eslint": "true",
|
||||||
|
"node.js.detected.package.tslint": "true",
|
||||||
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
|
"nodejs_package_manager_path": "npm",
|
||||||
|
"vue.rearranger.settings.migration": "true"
|
||||||
|
}
|
||||||
|
}]]></component>
|
||||||
|
<component name="SharedIndexes">
|
||||||
|
<attachedChunks>
|
||||||
|
<set>
|
||||||
|
<option value="bundled-jdk-9823dce3aa75-fdfe4dae3a2d-intellij.indexing.shared.core-IU-243.21565.193" />
|
||||||
|
<option value="bundled-js-predefined-d6986cc7102b-e768b9ed790e-JavaScript-IU-243.21565.193" />
|
||||||
|
</set>
|
||||||
|
</attachedChunks>
|
||||||
|
</component>
|
||||||
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
|
<component name="TaskManager">
|
||||||
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
<changelist id="e1fbeaad-6efe-4e4e-9cc3-db157d3cbbd0" name="Changes" comment="" />
|
||||||
|
<created>1739593846366</created>
|
||||||
|
<option name="number" value="Default" />
|
||||||
|
<option name="presentableId" value="Default" />
|
||||||
|
<updated>1739593846366</updated>
|
||||||
|
<workItem from="1739593847495" duration="18000" />
|
||||||
|
<workItem from="1739594598328" duration="1702000" />
|
||||||
|
<workItem from="1739615418937" duration="12348000" />
|
||||||
|
<workItem from="1739638286710" duration="2801000" />
|
||||||
|
<workItem from="1739696550212" duration="15168000" />
|
||||||
|
<workItem from="1739987384678" duration="5000" />
|
||||||
|
<workItem from="1739987550416" duration="37000" />
|
||||||
|
</task>
|
||||||
|
<servers />
|
||||||
|
</component>
|
||||||
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
<option name="version" value="3" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@ -101,7 +101,10 @@ stats auth igor:i123456
|
|||||||
sudo journalctl -u haproxy --no-pager | tail -n 50
|
sudo journalctl -u haproxy --no-pager | tail -n 50
|
||||||
````
|
````
|
||||||
Перезагружаем:
|
Перезагружаем:
|
||||||
sudo systemctl restart haproxy
|
```sh
|
||||||
|
sudo systemctl restart haproxy
|
||||||
|
````
|
||||||
|
|
||||||
И теперь должно открываться но адресу: http://data.ccalm.org:8989/
|
И теперь должно открываться но адресу: http://data.ccalm.org:8989/
|
||||||
Обязательно проверить как установился SSL чекером: https://www.leaderssl.ru/tools/ssl_checker
|
Обязательно проверить как установился SSL чекером: https://www.leaderssl.ru/tools/ssl_checker
|
||||||
|
|
||||||
|
|||||||
135
PostgreSQL_Exporter.md
Normal file
135
PostgreSQL_Exporter.md
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
Устанавливаю согласно инструкции из:
|
||||||
|
|
||||||
|
https://github.com/prometheus-community/postgres_exporter
|
||||||
|
|
||||||
|
Подключаюсь к нужной машине
|
||||||
|
```sh
|
||||||
|
ssh igor@ccalm.org -p 2200
|
||||||
|
```
|
||||||
|
|
||||||
|
## 1. Установка Docker и Docker Compose
|
||||||
|
Если Docker не установлен, установим его:
|
||||||
|
```sh
|
||||||
|
sudo apt update && sudo apt upgrade -y &&
|
||||||
|
sudo apt install -y docker.io docker-compose &&
|
||||||
|
sudo systemctl enable --now docker
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2. Установка postgres-exporter в докере из заранее подготовленного образа
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo mkdir -p /opt/postgres-exporter &&
|
||||||
|
sudo chown $USER:$USER /opt/postgres-exporter &&
|
||||||
|
cd /opt/postgres-exporter
|
||||||
|
```
|
||||||
|
|
||||||
|
Создаю файл с настройками
|
||||||
|
```sh
|
||||||
|
cd /opt/postgres-exporter/ &&
|
||||||
|
cat > docker-compose.yml <<EOF
|
||||||
|
services:
|
||||||
|
postgres-exporter:
|
||||||
|
image: quay.io/prometheuscommunity/postgres-exporter
|
||||||
|
container_name: postgres-exporter
|
||||||
|
restart: unless-stopped
|
||||||
|
network_mode: "host"
|
||||||
|
environment:
|
||||||
|
DATA_SOURCE_URI: "postgresql://postgres:309A86FF65A78FB428F4E38DFE35F730@localhost:5432/postgres?sslmode=disable"
|
||||||
|
volumes:
|
||||||
|
- ./postgres_exporter.yml:/etc/postgres_exporter.yml
|
||||||
|
command:
|
||||||
|
- "--config.file=/etc/postgres_exporter.yml"
|
||||||
|
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
Создаём файл с настройками
|
||||||
|
```sh
|
||||||
|
cd /opt/postgres-exporter/ &&
|
||||||
|
cat > postgres_exporter.yml <<EOF
|
||||||
|
collectors:
|
||||||
|
- database
|
||||||
|
- index
|
||||||
|
- query
|
||||||
|
- table
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
Запускаю:
|
||||||
|
```sh
|
||||||
|
cd /opt/postgres-exporter &&
|
||||||
|
sudo docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
Проверяю запущен ли докер
|
||||||
|
```sh
|
||||||
|
sudo docker ps
|
||||||
|
```
|
||||||
|
|
||||||
|
Testing with:
|
||||||
|
```sh
|
||||||
|
curl "http://127.0.0.1:9187/metrics"
|
||||||
|
```
|
||||||
|
|
||||||
|
Посмотреть журнал за сегодня:
|
||||||
|
```sh
|
||||||
|
journalctl --since today
|
||||||
|
```
|
||||||
|
|
||||||
|
Настраиваем простую авторизацию при помощи HAProxy для скачивания при помощи удаленного сервера
|
||||||
|
|
||||||
|
```sh
|
||||||
|
sudo mcedit /etc/haproxy/haproxy.cfg
|
||||||
|
```
|
||||||
|
Настраиваем:
|
||||||
|
```text
|
||||||
|
acl v_metrics_nd path_beg /metrics_nd
|
||||||
|
acl v_basic_auth http_auth(prometheus_list)
|
||||||
|
http-request auth realm Metrics_org_ccalm_nd if v_metrics_nd !v_basic_auth
|
||||||
|
use_backend b_metrics_nd if v_metrics_nd v_basic_auth
|
||||||
|
|
||||||
|
backend b_metrics_nd
|
||||||
|
mode http
|
||||||
|
option http-keep-alive
|
||||||
|
http-request replace-path .* /metrics
|
||||||
|
server web1 127.0.0.1:9100 check
|
||||||
|
```
|
||||||
|
|
||||||
|
Проверяем
|
||||||
|
```sh
|
||||||
|
haproxy -f /etc/haproxy/haproxy.cfg -c
|
||||||
|
````
|
||||||
|
Перезагружаем:
|
||||||
|
```sh
|
||||||
|
sudo systemctl restart haproxy
|
||||||
|
````
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Подключаюсь к машине где Prometeus:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ssh igor@192.168.200.84 -p 22
|
||||||
|
```
|
||||||
|
|
||||||
|
Перезагружаем prometheus чтобы он начал собирать метрики
|
||||||
|
```sh
|
||||||
|
sudo systemctl restart prometheus
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Теперь можно настраивать графану, вот готовыдашбоард
|
||||||
|
Открыть Grafana
|
||||||
|
Перейти в Dashboards → Import
|
||||||
|
Вставить ID: 9628
|
||||||
|
Выбрать источник данных Prometheus (с PostgreSQL Exporter)
|
||||||
|
Нажать Import
|
||||||
|
|
||||||
|
|
||||||
|
Теперь можно настраивать графану, вот готовыдашбоард
|
||||||
|
Открыть Grafana
|
||||||
|
Перейти в Dashboards → Import
|
||||||
|
Вставить ID: 12273
|
||||||
|
Выбрать источник данных Prometheus (с PostgreSQL Exporter)
|
||||||
|
Нажать Import
|
||||||
12
PostgreSQL_replication.md
Normal file
12
PostgreSQL_replication.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
Создано на основе https://www.cherryservers.com/blog/how-to-set-up-postgresql-database-replication
|
||||||
|
|
||||||
|
Подключаюсь к нужной машине
|
||||||
|
```sh
|
||||||
|
ssh igor@192.168.200.84 -p 22
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
341
rabbitmq_replication_setup_instructions.md
Normal file
341
rabbitmq_replication_setup_instructions.md
Normal file
@ -0,0 +1,341 @@
|
|||||||
|
Here’s a step-by-step guide to setting up a **RabbitMQ cluster with replication** correctly:
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **Step 1: Prepare the Servers**
|
||||||
|
|
||||||
|
Ensure you have at least **three** nodes (recommended for HA) with:
|
||||||
|
|
||||||
|
- Ubuntu 22.04 (or a supported OS)
|
||||||
|
- Sufficient CPU/RAM based on workload
|
||||||
|
- Open necessary firewall ports (**5672, 15672, 25672**)
|
||||||
|
|
||||||
|
Set hostnames for clarity:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo hostnamectl set-hostname rabbitmq-node1 # Change for each node
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **Step 2: Install Erlang and RabbitMQ**
|
||||||
|
|
||||||
|
Run the following on **all nodes**:
|
||||||
|
|
||||||
|
### **1. Add the RabbitMQ Repository**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y curl gnupg
|
||||||
|
curl -fsSL https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey | sudo tee /usr/share/keyrings/rabbitmq-key.asc
|
||||||
|
echo "deb [signed-by=/usr/share/keyrings/rabbitmq-key.asc] https://packagecloud.io/rabbitmq/rabbitmq-server/ubuntu/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/rabbitmq.list
|
||||||
|
```
|
||||||
|
|
||||||
|
### **2. Install Erlang and RabbitMQ**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y rabbitmq-server
|
||||||
|
```
|
||||||
|
|
||||||
|
### **3. Enable RabbitMQ**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo systemctl enable --now rabbitmq-server
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **Step 3: Configure Clustering**
|
||||||
|
|
||||||
|
### **1. Stop RabbitMQ on All Nodes**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo systemctl stop rabbitmq-server
|
||||||
|
```
|
||||||
|
|
||||||
|
### **2. Configure Cookie for Clustering**
|
||||||
|
|
||||||
|
Run on **all nodes** (same cookie ensures clustering works):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo "MY_CLUSTER_COOKIE" | sudo tee /var/lib/rabbitmq/.erlang.cookie
|
||||||
|
sudo chmod 600 /var/lib/rabbitmq/.erlang.cookie
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `"MY_CLUSTER_COOKIE"` with a strong, identical value on all nodes.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **Step 4: Join Nodes to the Cluster**
|
||||||
|
|
||||||
|
Perform this on **nodes 2 and 3**, joining them to **node1**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo rabbitmqctl stop_app
|
||||||
|
sudo rabbitmqctl join_cluster rabbit@rabbitmq-node1
|
||||||
|
sudo rabbitmqctl start_app
|
||||||
|
```
|
||||||
|
|
||||||
|
Check cluster status:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo rabbitmqctl cluster_status
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **Step 5: Enable High Availability (HA) Mirroring**
|
||||||
|
|
||||||
|
To replicate all queues, run on **any one node**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rabbitmqctl set_policy ha-all "^.*" '{"ha-mode":"all","ha-sync-mode":"automatic"}'
|
||||||
|
```
|
||||||
|
|
||||||
|
This ensures all queues are **replicated across all nodes**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **Step 6: Enable Management UI**
|
||||||
|
|
||||||
|
Run on **each node** to enable the web interface:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo rabbitmq-plugins enable rabbitmq_management
|
||||||
|
```
|
||||||
|
|
||||||
|
Access at:
|
||||||
|
**http://[NODE_IP]:15672**
|
||||||
|
(Default login: `guest/guest`, change this for security.)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **Step 7: Test the Cluster**
|
||||||
|
|
||||||
|
Run on **each node**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rabbitmqctl list_queues
|
||||||
|
```
|
||||||
|
|
||||||
|
Queues should be visible and synchronized.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **Step 8: Enable Auto-Recovery** (Optional)
|
||||||
|
|
||||||
|
Edit `/etc/rabbitmq/rabbitmq.conf` on **each node** and add:
|
||||||
|
|
||||||
|
```ini
|
||||||
|
cluster_formation.peer_discovery_backend = classic_config
|
||||||
|
cluster_formation.classic_config.nodes.1 = rabbit@rabbitmq-node1
|
||||||
|
cluster_formation.classic_config.nodes.2 = rabbit@rabbitmq-node2
|
||||||
|
cluster_formation.classic_config.nodes.3 = rabbit@rabbitmq-node3
|
||||||
|
```
|
||||||
|
|
||||||
|
Then restart RabbitMQ:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo systemctl restart rabbitmq-server
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **Step 9: Secure the Cluster** (Recommended)
|
||||||
|
|
||||||
|
### **1. Create an Admin User**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rabbitmqctl add_user admin StrongPassword123!
|
||||||
|
rabbitmqctl set_user_tags admin administrator
|
||||||
|
rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
|
||||||
|
```
|
||||||
|
|
||||||
|
Then **disable the guest account**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rabbitmqctl delete_user guest
|
||||||
|
```
|
||||||
|
|
||||||
|
### **2. Enable TLS (Optional)**
|
||||||
|
|
||||||
|
For security, configure TLS in `/etc/rabbitmq/rabbitmq.conf`. Refer to RabbitMQ’s [TLS guide](https://www.rabbitmq.com/ssl.html).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **Step 10: Setup Monitoring (Optional)**
|
||||||
|
|
||||||
|
Install **Prometheus & Grafana** or use **RabbitMQ Prometheus plugin**:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo rabbitmq-plugins enable rabbitmq_prometheus
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Now your RabbitMQ cluster is fully set up with **replication and high availability**! 🚀
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
# Instructions to fix **unexpected** configuration errors
|
||||||
|
|
||||||
|
If you can't find the RabbitMQ config file under `/etc/rabbitmq`, it may not exist by default. You need to **create it manually**. Here's how:
|
||||||
|
|
||||||
|
## **1️⃣ Create the Configuration File**
|
||||||
|
|
||||||
|
RabbitMQ uses either a **`.conf` file** (modern format) or a **`.config` file** (legacy format). The recommended format is `.conf`.
|
||||||
|
|
||||||
|
Create the file if it doesn't exist:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo nano /etc/rabbitmq/rabbitmq.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
Then add the following cluster configuration:
|
||||||
|
|
||||||
|
```
|
||||||
|
cluster_formation.peer_discovery_backend = classic_config
|
||||||
|
cluster_formation.classic_config.nodes.1 = rabbit@rabbitmq-main
|
||||||
|
cluster_formation.classic_config.nodes.2 = rabbit@rabbitmq-replica
|
||||||
|
```
|
||||||
|
|
||||||
|
Save and exit (`CTRL+X`, then `Y`, then `Enter`).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **2️⃣ Set Correct Permissions**
|
||||||
|
|
||||||
|
Ensure the RabbitMQ user can read it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo chown rabbitmq:rabbitmq /etc/rabbitmq/rabbitmq.conf
|
||||||
|
sudo chmod 644 /etc/rabbitmq/rabbitmq.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **3️⃣ Restart RabbitMQ**
|
||||||
|
|
||||||
|
After modifying the configuration, restart the RabbitMQ service:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo systemctl restart rabbitmq-server
|
||||||
|
```
|
||||||
|
|
||||||
|
Check the status:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo systemctl status rabbitmq-server
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **4️⃣ Verify the Cluster Configuration**
|
||||||
|
|
||||||
|
After restarting, verify that clustering is working:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rabbitmqctl cluster_status
|
||||||
|
```
|
||||||
|
|
||||||
|
If the nodes are listed correctly, your setup is working.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **5️⃣ If Using the Legacy `.config` Format**
|
||||||
|
|
||||||
|
Some older installations use an **Erlang-based configuration file** (`rabbitmq.config`). If you prefer that, create:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo nano /etc/rabbitmq/rabbitmq.config
|
||||||
|
```
|
||||||
|
|
||||||
|
Add this:
|
||||||
|
|
||||||
|
```erlang
|
||||||
|
[
|
||||||
|
{rabbit, [
|
||||||
|
{cluster_formation, [
|
||||||
|
{peer_discovery_backend, classic_config},
|
||||||
|
{classic_config, [
|
||||||
|
{nodes, ['rabbit@rabbitmq-main', 'rabbit@rabbitmq-replica']}
|
||||||
|
]}
|
||||||
|
]}
|
||||||
|
]}
|
||||||
|
].
|
||||||
|
```
|
||||||
|
|
||||||
|
Then restart RabbitMQ:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo systemctl restart rabbitmq-server
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### **🔍 Troubleshooting**
|
||||||
|
|
||||||
|
❌ **RabbitMQ doesn't restart?**
|
||||||
|
Check logs for errors:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo journalctl -u rabbitmq-server --no-pager | tail -50
|
||||||
|
```
|
||||||
|
|
||||||
|
❌ **Cluster not forming?**
|
||||||
|
Try forcing a node to join manually:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rabbitmqctl stop_app
|
||||||
|
rabbitmqctl join_cluster rabbit@rabbitmq-main
|
||||||
|
rabbitmqctl start_app
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
# Instructions to fix **unexpected** management UI authentication errors
|
||||||
|
|
||||||
|
stackoverflow answer [link](https://stackoverflow.com/a/40845332/27251837)
|
||||||
|
|
||||||
|
## Answer
|
||||||
|
|
||||||
|
### ❌ **Cannot login with guest/guest credentials**
|
||||||
|
|
||||||
|
I had the same Problem..
|
||||||
|
|
||||||
|
I installed RabbitMQ and Enabled Web Interface also but still couldn't sign in with any user i newly created, this is because you need to be administrator to access this.
|
||||||
|
|
||||||
|
Do not create any config file and mess with it..
|
||||||
|
|
||||||
|
This is what i did then,
|
||||||
|
|
||||||
|
1. Add a new/fresh user, say user test and password test:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rabbitmqctl add_user test test
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Give administrative access to the new user:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rabbitmqctl set_user_tags test administrator
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Set permission to newly created user:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
|
||||||
|
```
|
||||||
|
|
||||||
|
That's it, enjoy :)
|
||||||
Reference in New Issue
Block a user