rabbitmq中的vhost未启动

qni6mghb  于 2022-11-08  发布在  RabbitMQ
关注(0)|答案(2)|浏览(337)

我的rabbitmq工作正常。突然,其中一个vhost无法启动。在重新启动rabbitmq服务器时,它显示在管理UI中,该错误正在启动vhost,并且所有队列都处于关闭状态。以下是我重新启动vhost时出现的错误。请提供建议。**我们的生产消息代理已关闭,需要立即帮助。**Rabbitmq版本- 3.8.3 Erlang版本- 22.3

Trying to restart vhost 'r_t' on node 'rabbit@myserver' ...
Error:
Failed to start vhost 'r_t' on node 'rabbit@myserver'Reason: {:shutdown, {:failed_to_start_child, 
:rabbit_vhost_process, {:error, {{{:badarg, [{:erlang, :binary_to_term, [<<131, 104, 6, 100, 0, 13, 98, 
97, 115, 105, 99, 95, 109, 101, 115, 115, 97, 103, 101, 104, 4, 100, 0, 8, 114, 101, 115, 111, 117, 114,
99, 101, 109, 0, ...>>], []}, {:rabbit_queue_index, :parse_pub_record_body, 2, [file: 
'src/rabbit_queue_index.erl', line: 783]}, {:rabbit_queue_index, :"-segment_entries_foldr/3-fun-0-", 4, 
[file: 'src/rabbit_queue_index.erl', line: 1111]}, {:array, :sparse_foldr_3, 6, [file: 'array.erl', line:
1847]}, {:array, :sparse_foldr_2, 8, [file: 'array.erl', line: 1836]}, {:rabbit_queue_index, 
:scan_queue_segments, 3, [file: 'src/rabbit_queue_index.erl', line: 741]}, {:rabbit_queue_index, 
:queue_index_walker_reader, 2, [file: 'src/rabbit_queue_index.erl', line: 728]}, {:rabbit_queue_index, 
:"-queue_index_walker/1-fun-1-", 2, [file: 'src/rabbit_queue_index.erl', line: 710]}]}, {:gen_server2, 
:call, [#PID<10691.1882.0>, :out, :infinity]}}, {:child, :undefined, :msg_store_persistent, 
{:rabbit_msg_store, :start_link, [:msg_store_persistent, 
'/var/lib/rabbitmq/mnesia/rabbit@1myserver/msg_stores/vhosts/1SLGRHB3T7STV1U1TEB4MR6QS', [], 
{#Function<2.23124100/1 in :rabbit_queue_index>, {:start, [{:resource, "r_t", :queue, 
"product.import_royn_se"}, {:resource, "r_t", :queue, "customer.import_ronin_es"},  {:resource, "r_t", 
...}, {:resource, ...}, {...}, ...]}}]}, :transient, 30000, :worker, [:rabbit_msg_store]}}}}}
xwbd5t1u

xwbd5t1u1#

我找到了一个解决方法。我们只是导出并保存了未启动的现有vhost的vhost定义。然后删除了此vhost。创建了相同的vhost并将定义导入回来。因此,我们得到了具有相同功能的所有队列。

bzzcjhmw

bzzcjhmw2#

  • 〉用于转储所有消息
from os import listdir
from os.path import isfile, join
import re
base_path = '/docker/rabbitmq-nfe/data/mnesia/rabbit@rabbitmq_nfe/msg_stores/vhosts/628WB79CIFDYO9LJI6DKMI09L/queues'
list_queues = listdir(base_path)

# GET ALL QUEUES

for queue in list_queues:
  dir_queue = '%s/%s' % (base_path, queue)
  list_files = [f for f in listdir(dir_queue) if isfile(join(dir_queue, f)) and f not in ['.queue_name', 'journal.jif']]  
  list_files.sort()
  name_queue = open('%s/.queue_name' % (dir_queue), 'r').read().split('QUEUE: ')[-1][:-1]
  payload_queue = []
  #GET ALL FILES QUEUES
  for file in list_files:      
    path_file = '%s/%s' % (dir_queue, file)
    binary_file = open(path_file, 'r')
    string_file = binary_file.read()
    string_file_decoded = string_file.decode('iso 8859-1')
    #GET ALL PAYLOAD FILES QUEUES
    list_payload_queue = ['{%s}' % f for f in re.split('\{(.*?)\}', string_file_decoded) if 'chave' in f and 'rede' in f]
    for idx, payload in enumerate(list_payload_queue):
      if payload.count('{') > 1:
        list_payload_queue[idx] = ['{%s' % f for f in payload.split('{') if 'chave' in f and 'rede' in f][0]
    payload_queue = payload_queue + list_payload_queue
  #SAVE BACKUP QUEUES
  print('FILA: %s ARQUIVOS: %s' % (name_queue, str(len(payload_queue))))
  with open('/tmp/%s.log' % name_queue, 'w') as f:
    for line in payload_queue:
      f.write("%s\n" % line)

相关问题