sudo vim /etc/apt/sources.list.d/rabbitmq.list ===== deb http://www.rabbitmq.com/debian/ testing main ===== # Add signature wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc sudo apt-key add rabbitmq-signing-key-public.asc # apt-get sudo apt-get update sudo apt-get install rabbitmq-server # Check status sudo /etc/init.d/rabbitmq-server status ===== Status of node rabbit@www1242up ... [{pid,21208}, {running_applications,[{rabbit,"RabbitMQ","3.5.0"}, {mnesia,"MNESIA CXC 138 12","4.5"}, {os_mon,"CPO CXC 138 46","2.2.7"}, {xmerl,"XML parser","1.2.10"}, {sasl,"SASL CXC 138 11","2.1.10"}, {stdlib,"ERTS CXC 138 10","1.17.5"}, {kernel,"ERTS CXC 138 10","2.14.5"}]}, {os,{unix,linux}}, {erlang_version,"Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:3:3] [rq:3] [async-threads:30] [kernel-poll:true]\n"}, {memory,[{total,28074848}, {connection_readers,0}, {connection_writers,0}, {connection_channels,0}, {connection_other,2704}, {queue_procs,2704}, {queue_slave_procs,0}, {plugins,0}, {other_proc,9304344}, {mnesia,60560}, {mgmt_db,0}, {msg_index,34680}, {other_ets,776160}, {binary,8632}, {code,14672972}, {atom,1363353}, {other_system,1848739}]}, {alarms,[]}, {listeners,[{clustering,25672,"::"},{amqp,5672,"::"}]}, {vm_memory_high_watermark,0.4}, {vm_memory_limit,840266547}, {disk_free_limit,50000000}, {disk_free,165005750272}, {file_descriptors,[{total_limit,924}, {total_used,3}, {sockets_limit,829}, {sockets_used,1}]}, {processes,[{limit,1048576},{used,125}]}, {run_queue,0}, {uptime,20}] =====
Next is client code.source "https://rubygems.org" gem "bunny", ">= 1.7.0"
Let’s run the client with following command.#!/usr/bin/env ruby # encoding: utf-8 require "rubygems" require "bunny" conn = Bunny.new conn.start ch = conn.create_channel q = ch.queue("bunny.examples.hello_world", :auto_delete => true) x = ch.default_exchange q.subscribe do |delivery_info, metadata, payload| puts "Received #{payload}" end x.publish("Hello!", :routing_key => q.name) sleep 1.0 conn.close
It looks work.bundle install ===== Fetching gem metadata from https://rubygems.org/... Resolving dependencies... Installing amq-protocol 1.9.2 Installing bunny 1.7.0 Using bundler 1.7.4 Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. ===== ls ===== client.rb Gemfile Gemfile.lock ===== bundle exec ruby client.rb ===== Received Hello! =====
If you access “http://targethost:15672”, you can reach the following page. Initial account is username => guest, password => guest.sudo rabbitmq-plugins list ===== Configured: E = explicitly enabled; e = implicitly enabled | Status: * = running on rabbit@www1242up |/ [ ] amqp_client 3.5.0 [ ] cowboy 0.5.0-rmq3.5.0-git4b93c2d [ ] eldap 3.5.0-gite309de4 [ ] mochiweb 2.7.0-rmq3.5.0-git680dba8 [ ] rabbitmq_amqp1_0 3.5.0 [ ] rabbitmq_auth_backend_ldap 3.5.0 [ ] rabbitmq_auth_mechanism_ssl 3.5.0 [ ] rabbitmq_consistent_hash_exchange 3.5.0 [ ] rabbitmq_federation 3.5.0 [ ] rabbitmq_federation_management 3.5.0 [ ] rabbitmq_management 3.5.0 [ ] rabbitmq_management_agent 3.5.0 [ ] rabbitmq_management_visualiser 3.5.0 [ ] rabbitmq_mqtt 3.5.0 [ ] rabbitmq_shovel 3.5.0 [ ] rabbitmq_shovel_management 3.5.0 [ ] rabbitmq_stomp 3.5.0 [ ] rabbitmq_test 3.5.0 [ ] rabbitmq_tracing 3.5.0 [ ] rabbitmq_web_dispatch 3.5.0 [ ] rabbitmq_web_stomp 3.5.0 [ ] rabbitmq_web_stomp_examples 3.5.0 [ ] sockjs 0.3.4-rmq3.5.0-git3132eb9 [ ] webmachine 1.10.3-rmq3.5.0-gite9359c7 ===== sudo rabbitmq-plugins enable rabbitmq_management ===== The following plugins have been enabled: mochiweb webmachine rabbitmq_web_dispatch amqp_client rabbitmq_management_agent rabbitmq_management Applying plugin configuration to rabbit@... started 6 plugins. ===== sudo rabbitmq-plugins list ===== Configured: E = explicitly enabled; e = implicitly enabled | Status: * = running on rabbit@www1242up |/ [e*] amqp_client 3.5.0 [ ] cowboy 0.5.0-rmq3.5.0-git4b93c2d [ ] eldap 3.5.0-gite309de4 [e*] mochiweb 2.7.0-rmq3.5.0-git680dba8 [ ] rabbitmq_amqp1_0 3.5.0 [ ] rabbitmq_auth_backend_ldap 3.5.0 [ ] rabbitmq_auth_mechanism_ssl 3.5.0 [ ] rabbitmq_consistent_hash_exchange 3.5.0 [ ] rabbitmq_federation 3.5.0 [ ] rabbitmq_federation_management 3.5.0 [E*] rabbitmq_management 3.5.0 [e*] rabbitmq_management_agent 3.5.0 [ ] rabbitmq_management_visualiser 3.5.0 [ ] rabbitmq_mqtt 3.5.0 [ ] rabbitmq_shovel 3.5.0 [ ] rabbitmq_shovel_management 3.5.0 [ ] rabbitmq_stomp 3.5.0 [ ] rabbitmq_test 3.5.0 [ ] rabbitmq_tracing 3.5.0 [e*] rabbitmq_web_dispatch 3.5.0 [ ] rabbitmq_web_stomp 3.5.0 [ ] rabbitmq_web_stomp_examples 3.5.0 [ ] sockjs 0.3.4-rmq3.5.0-git3132eb9 [e*] webmachine 1.10.3-rmq3.5.0-gite9359c7 ===== #Check port number netstat -l ===== Proto Recv-Q Send-Q Local Address Foreign Address State ... tcp 0 0 *:15672 *:* LISTEN ... ===== #Allow the port sudo ufw allow 15672 ===== Rule added Rule added (v6) ===== # Add user setting sudo vim /etc/rabbitmq/rabbitmq.config ===== [{rabbit, [{loopback_users, []}]}]. ===== # Restart sudo /etc/init.d/rabbitmq-server restart
Streamlit is a …
I bought M5Stac…