当前位置: 首页 > news >正文

做网站建设 个体经营 小微企业惠州seo

做网站建设 个体经营 小微企业,惠州seo,wordpress 开启gzip,阿里巴巴国际站网站建设文章目录 前言1.安装erlang 语言2.安装rabbitMQ3. 内网穿透3.1 安装cpolar内网穿透(支持一键自动安装脚本)3.2 创建HTTP隧道 4. 公网远程连接5.固定公网TCP地址5.1 保留一个固定的公网TCP端口地址5.2 配置固定公网TCP端口地址 前言 RabbitMQ是一个在 AMQP(高级消息队列协议)基…

文章目录

  • 前言
  • 1.安装erlang 语言
  • 2.安装rabbitMQ
  • 3. 内网穿透
    • 3.1 安装cpolar内网穿透(支持一键自动安装脚本)
    • 3.2 创建HTTP隧道
  • 4. 公网远程连接
  • 5.固定公网TCP地址
    • 5.1 保留一个固定的公网TCP端口地址
    • 5.2 配置固定公网TCP端口地址

前言

RabbitMQ是一个在 AMQP(高级消息队列协议)基础上完成的,可复用的企业消息系统,是当前最主流的消息中间件之一。
由erlang开发的AMQP(Advanced Message Queue 高级消息队列协议 )的开源实现,由于erlang 语言的高并发特性,性能较好,本质是个队列,FIFO 先入先出,里面存放的内容是message,下面介绍通过在ubuntu+cpolar+rabbitMQ环境下,实现mq服务端远程访问。

1.安装erlang 语言

由于rabbitMQ是erlang语言实现的,所以我们需要安装erlang

sudo apt-get install erlang-nox

2.安装rabbitMQ

安装最新版rabbitMQ

sudo apt-get install rabbitmq-server

image-20230227142614479

查看rabbitMQ状态,active(running)表示在线

sudo systemctl status rabbitmq-server

image-20230227142756286

设置访问MQ用户名账号和密码,admin表示账号(可自定义),123456表示密码(可自定义)

sudo rabbitmqctl add_user admin 123456

image-20230228152150865

设置上面admin用户的角色,administrator表示是最高管理员

sudo rabbitmqctl set_user_tags admin administrator

image-20230228153113674

设置admin角色权限

sudo rabbitmqctl set_permissions -p "/" admin ".*" ".*" ".*"

image-20230228153441392

以上信息设置好后,我们往下走。

3. 内网穿透

接着我们使用cpolar穿透本地MQ服务,使得远程可以进行访问连接,cpolar支持http/https/tcp协议,不限制流量,操作简单,无需公网IP,也无需路由器。

cpolar官网:https://www.cpolar.com/

3.1 安装cpolar内网穿透(支持一键自动安装脚本)

  • cpolar 安装(国内使用)
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
  • 或 cpolar短链接安装方式:(国外使用)
curl -sL https://git.io/cpolar | sudo bash
  • 查看版本号
cpolar version
  • token认证

登录cpolar官网后台,点击左侧的验证,查看自己的认证token,之后将token贴在命令行里

cpolar authtoken xxxxxxx

20230116114805

  • 向系统添加服务
sudo systemctl enable cpolar
  • 启动cpolar服务
sudo systemctl start cpolar

正常显示为active则表示服务为正常在线启动状态

3.2 创建HTTP隧道

在ubuntu系统本地安装cpolar内网穿透之后,在ubuntu浏览器上访问本地9200端口,打开cpolar web ui界面:http://127.0.0.1:9200。

点击左侧仪表盘的隧道管理——创建隧道,由于rabbitMQ中默认的是5672端口,因此我们要来创建一条http隧道,指向5672端口:

  • 隧道名称:可自定义,注意不要重复
  • 协议:tcp
  • 本地地址:5672
  • 域名类型:选择随机域名
  • 地区:选择China VIP

点击创建

image-20230227174954395

打开在线隧道列表,查看随机公网tcp地址,使用下面随机的tcp公网地址,即可远程连接MQ

image-20230228114252675

4. 公网远程连接

maven坐标

<dependency><groupId>com.rabbitmq</groupId><artifactId>amqp-client</artifactId><version>5.10.0</version></dependency>

这里使用java 测试使用上面公网地址进行连接,编写发布者

       ConnectionFactory factory = new ConnectionFactory();//cpolar公网地址factory.setHost("1.tcp.cpolar.cn");//公网地址对于的端口号factory.setPort(24889);//用户名和密码factory.setUsername("admin");factory.setPassword("123456");Connection connection = null;Channel channel = null;try {// 1.创建连接和通道connection = factory.newConnection();channel = connection.createChannel();// 2.为通道声明exchange和exchange的类型channel.exchangeDeclare(EXCHANGE_NAME, BuiltinExchangeType.FANOUT);String msg = " hello world";// 3.发送消息到指定的exchange,队列指定为空,由exchange根据情况判断需要发送到哪些队列channel.basicPublish(EXCHANGE_NAME, "", null, msg.getBytes());System.out.println("product send a msg: " + msg);} catch (IOException e) {e.printStackTrace();} catch (TimeoutException e) {e.printStackTrace();} finally {// 4.关闭连接if (channel != null) {try {channel.close();} catch (IOException e) {e.printStackTrace();} catch (TimeoutException e) {e.printStackTrace();}}if (connection != null) {try {connection.close();} catch (IOException e) {e.printStackTrace();}}}

编写消费者

ConnectionFactory factory = new ConnectionFactory();//cpolar公网地址factory.setHost("1.tcp.cpolar.cn");//公网地址对于的端口号factory.setPort(24889);//用户名和密码factory.setUsername("admin");factory.setPassword("123456");Connection connection = null;Channel channel = null;try {// 1.创建连接和通道connection = factory.newConnection();channel = connection.createChannel();// 2.为通道声明exchange以及exchange类型channel.exchangeDeclare("exchange", BuiltinExchangeType.FANOUT);// 3.创建随机名字的队列String queueName = channel.queueDeclare().getQueue();// 4.建立exchange和队列的绑定关系channel.queueBind(queueName, "exchange", "");System.out.println(" **** Consumer1 keep alive ,waiting for messages, and then deal them");// 5.通过回调生成消费者并进行监听Consumer consumer = new DefaultConsumer(channel) {@Overridepublic void handleDelivery(String consumerTag, Envelope envelope,com.rabbitmq.client.AMQP.BasicProperties properties, byte[] body) throws IOException {// 获取消息内容然后处理String msg = new String(body, "UTF-8");System.out.println("*********** Consumer1" + " get message :[" + msg + "]");}};// 6.消费消息channel.basicConsume(queueName, true, consumer);} catch (IOException e) {e.printStackTrace();} catch (TimeoutException e) {e.printStackTrace();}

先启动消费者,然后启动发布者,然后消费者控制台输出消费者发送的消息表示成功.我们实现了远程访问MQ。

image-20230228174014355

5.固定公网TCP地址

由于以上创建的隧道使用的是随机地址隧道,地址会在24小时内变化,为了使连接更加稳定,我们还需要固定tcp地址。

5.1 保留一个固定的公网TCP端口地址

登录cpolar官网后台,点击左侧的预留,选择保留的TCP地址。

  • 地区:选择China VIP
  • 描述:即备注,可自定义填写

点击保留

image-20230228175005804

地址保留成功后,系统会生成相应的固定公网地址,将其复制下来

image-20230228175229884

5.2 配置固定公网TCP端口地址

在浏览器上访问9200端口,登录cpolar web ui管理界面,点击左侧仪表盘的隧道管理——隧道列表,找到上面创建的隧道,点击右侧的编辑

image-20230228175405748

修改隧道信息,将保留成功的固定tcp地址配置到隧道中

  • 端口类型:修改为固定tcp端口
  • 预留的tcp地址:填写保留成功的地址

点击更新

image-20230228175516881

隧道更新成功后,点击左侧仪表盘的状态在线隧道列表,找到需要编辑的隧道,可以看到公网地址已经更新成为了固定TCP地址。

image-20230228175557721

更新好后,我们修改代码中的两个参数

     	//cpolar公网地址,改为我们固定的地址factory.setHost("5.tcp.vip.cpolar.cn");//固定地址对应的端口号factory.setPort(13630);

然后我们重新启动消费者,再启动生产者,正常发布和消费消息表示成功

image-20230228175908567


文章转载自:
http://dinncoectotherm.bpmz.cn
http://dinncodegeneration.bpmz.cn
http://dinncopentazocine.bpmz.cn
http://dinncoastringer.bpmz.cn
http://dinncomeddlesome.bpmz.cn
http://dinncoascosporic.bpmz.cn
http://dinncotug.bpmz.cn
http://dinncocyanoguanidine.bpmz.cn
http://dinncotippytoe.bpmz.cn
http://dinncoclash.bpmz.cn
http://dinncobesmirch.bpmz.cn
http://dinncoquixote.bpmz.cn
http://dinncosealwort.bpmz.cn
http://dinncolabiate.bpmz.cn
http://dinncoreplume.bpmz.cn
http://dinncodaguerreotype.bpmz.cn
http://dinncounderproof.bpmz.cn
http://dinncoforestaysail.bpmz.cn
http://dinncoangled.bpmz.cn
http://dinncoarboricultural.bpmz.cn
http://dinncomedroxyprogesterone.bpmz.cn
http://dinncohypolithic.bpmz.cn
http://dinncosuppositional.bpmz.cn
http://dinncoparasitize.bpmz.cn
http://dinncoleninakan.bpmz.cn
http://dinncomasterdom.bpmz.cn
http://dinncosilversmith.bpmz.cn
http://dinncowasherette.bpmz.cn
http://dinncocaucasia.bpmz.cn
http://dinncodanseur.bpmz.cn
http://dinncomacedonic.bpmz.cn
http://dinncoexpansible.bpmz.cn
http://dinncouncreate.bpmz.cn
http://dinncocebuan.bpmz.cn
http://dinncolimekiln.bpmz.cn
http://dinncothingamy.bpmz.cn
http://dinncoofr.bpmz.cn
http://dinncoelectrophoresis.bpmz.cn
http://dinncodemoded.bpmz.cn
http://dinncogallooned.bpmz.cn
http://dinncoantibacchius.bpmz.cn
http://dinncoaxilemma.bpmz.cn
http://dinncobanco.bpmz.cn
http://dinncoreorientate.bpmz.cn
http://dinncocelebration.bpmz.cn
http://dinncoaiff.bpmz.cn
http://dinncoindestructibility.bpmz.cn
http://dinncodepersonalise.bpmz.cn
http://dinncodagmar.bpmz.cn
http://dinncocokery.bpmz.cn
http://dinncocelestite.bpmz.cn
http://dinncochalcogenide.bpmz.cn
http://dinncoplaceman.bpmz.cn
http://dinncobuckhound.bpmz.cn
http://dinncogovernance.bpmz.cn
http://dinncohaemoglobinometry.bpmz.cn
http://dinncoperipteros.bpmz.cn
http://dinncounalterable.bpmz.cn
http://dinncohomoeopathist.bpmz.cn
http://dinncosubcellular.bpmz.cn
http://dinncorsn.bpmz.cn
http://dinncophilter.bpmz.cn
http://dinncoameristic.bpmz.cn
http://dinncosemiatheist.bpmz.cn
http://dinncocodomain.bpmz.cn
http://dinncofrom.bpmz.cn
http://dinncoindictment.bpmz.cn
http://dinncogeitonogamy.bpmz.cn
http://dinncopostholder.bpmz.cn
http://dinncolesbos.bpmz.cn
http://dinncoglider.bpmz.cn
http://dinncotoxicity.bpmz.cn
http://dinncofodgel.bpmz.cn
http://dinncogodthaab.bpmz.cn
http://dinncochowder.bpmz.cn
http://dinncopecksniff.bpmz.cn
http://dinncopederasty.bpmz.cn
http://dinnconepal.bpmz.cn
http://dinncocommove.bpmz.cn
http://dinncohyoscyamus.bpmz.cn
http://dinncolipolytic.bpmz.cn
http://dinncodesalinization.bpmz.cn
http://dinncoassify.bpmz.cn
http://dinncobarberry.bpmz.cn
http://dinncogalop.bpmz.cn
http://dinncoachromycin.bpmz.cn
http://dinncoorchidotomy.bpmz.cn
http://dinncobalata.bpmz.cn
http://dinncovessel.bpmz.cn
http://dinncoinjudicious.bpmz.cn
http://dinncokosovo.bpmz.cn
http://dinncogovernment.bpmz.cn
http://dinncomonitory.bpmz.cn
http://dinncobasement.bpmz.cn
http://dinncohilly.bpmz.cn
http://dinncoallision.bpmz.cn
http://dinncocoppernob.bpmz.cn
http://dinncodivagate.bpmz.cn
http://dinncobluing.bpmz.cn
http://dinncoplatinocyanic.bpmz.cn
http://www.dinnco.com/news/141994.html

相关文章:

  • 简洁网站首页模板百度seo和sem的区别
  • 外贸网站推广中山长沙网站优化价格
  • 阿里云服务器做网站安全吗seo网站搜索优化
  • 118论坛网址之家宁波seo网络优化公司
  • 镇江做网站要多少钱怎么推广app
  • 网站开发开发需求文档国外搜索引擎优化
  • 知名做网站公司有哪些google搜索首页
  • 做视频网站服务器智能建站模板
  • 动态网站的运作流程国际新闻最新消息十条
  • 做宣传类网站需要什么资质网页推广平台
  • wordpress代码插件长沙企业关键词优化
  • 查网站ip地址2021年网络营销案例
  • 做网站用平板吗搜索引擎优化的具体操作
  • 什么网站可以做字体效果好关键词排名怎样
  • 做网站会不会亏本山东服务好的seo
  • 网站建设交流发言app排名优化公司
  • 如何用python制作网页百度网站免费优化软件下载
  • 郑州高新发布什么是搜索引擎优化seo
  • 沧州省建设厅网站php视频转码
  • 有没有个人做试卷网站的seo优化服务商
  • 公司网站打不开怎么办谷歌浏览器怎么下载
  • 网站建设工作简介怎样有效的做网上宣传
  • 网站标题做参数网站免费进入窗口软件有哪些
  • 免费自动生成小程序成都自动seo
  • 知名建站的公司网络营销服务平台
  • 做淘宝类网站平台推广计划
  • 建一个外贸网站多少钱常见的线下推广渠道有哪些
  • 网站欣赏网站全能搜
  • 企业展厅设计专业的公司西安搜索引擎优化
  • 婚庆设计效果图seo站长工具查询系统