erlang

RabbitMQ消息队列系列教程(二)Windows下安装和部署RabbitMQ

血红的双手。 提交于 2021-02-19 01:42:47
摘要 本篇经验将和大家介绍Windows下安装和部署RabbitMQ消息队列服务器,希望对大家的工作和学习有所帮助! 目录 一、Erlang语言环境的搭建 二、RabbitMQ服务环境的搭建 三、RabbitMQ服务Web管理工具 一、Erlang语言环境的搭建 RabbitMQ开源消息队列服务是使用Erlang语言开发的,因此我们要使用他就必须先进行Erlang语言环境的搭建,其实是非常简单的。 下载地址: http://www.erlang.org/downloads 1. 登录Erlang官网,进入下载页,然后按照自己的系统环境来选择需要下载的安装文件。 2.安装完成后,配置Erlang环境变量。 ERLANG_HOME: erlang安装路径 PATH:%ERLANG_HOME%\bin 如何修改环境变量请参考: https://jingyan.baidu.com/article/b24f6c82cba6dc86bfe5da9f.html 二、RabbitMQ服务环境的搭建 1. 到官网下载安装最新RabbitMQ程序。 下载地址: http://www.rabbitmq.com/install-windows.html 2.启动RabbitMQ服务。 RabbitMQ默认自动启动服务,你可以通过开始菜单以及命令行,启动和关闭RabbitMQ服务。 三

UTF8, codepoints, and their representation in Erlang and Elixir

时光毁灭记忆、已成空白 提交于 2021-02-18 19:13:07
问题 going through Elixir's handling of unicode: iex> String.codepoints("abc§") ["a", "b", "c", "§"] very good, and byte_size/2 of this is not 4 but 5, because the last char is taking 2 bytes, I get that. The ? operator (or is it a macro? can't find the answer) tells me that iex(69)> ?§ 167 Great; so then I look into the UTF-8 encoding table, and see value c2 a7 as hex encoding for the char. That means the two bytes (as witnessed by byte_size/1) are c2 (94 in decimal) and a7 (167 in decimal). That

Mixed Erlang/Elixir projects - can I use mix or rebar?

谁都会走 提交于 2021-02-18 06:03:02
问题 For Erlang code, I use rebar . For Elixir code, I use the built-in mix tool. Now I want to have a mixed Erlang/Elixir project. Can I use rebar to compile Elixir code? Or can I use mix to compile Erlang code? If so, how? 回答1: Mix can compile erlang files if you put them in src . There is a rebar_elixir_plugin to compile Elixir code from rebar but it is not as efficient at it as Mix. 来源: https://stackoverflow.com/questions/19776403/mixed-erlang-elixir-projects-can-i-use-mix-or-rebar

Mixed Erlang/Elixir projects - can I use mix or rebar?

此生再无相见时 提交于 2021-02-18 06:02:46
问题 For Erlang code, I use rebar . For Elixir code, I use the built-in mix tool. Now I want to have a mixed Erlang/Elixir project. Can I use rebar to compile Elixir code? Or can I use mix to compile Erlang code? If so, how? 回答1: Mix can compile erlang files if you put them in src . There is a rebar_elixir_plugin to compile Elixir code from rebar but it is not as efficient at it as Mix. 来源: https://stackoverflow.com/questions/19776403/mixed-erlang-elixir-projects-can-i-use-mix-or-rebar

MQ简介

落花浮王杯 提交于 2021-02-14 17:54:47
MQ概述 MQ是Message Queue的简称,意为消息队列,从字面意思上可以理解MQ的是一个存放消息的容器,并且它的 数据结构为队列(FIFO先进先出) 。MQ一般应用于 应用解耦,异步处理提速,流量削峰 ,实现高性能,高可用,可伸缩和最终一致性架构。 在MQ中一般存在三种角色 Broker、生产者、消费者 ,在不同的MQ产品中,也会存在不同的其他角色,这里只简单介绍一下主要的三种角色的作用:Broker也就是MQ服务,用于将生产者发送过来的消息按照类型分类存放在不同的队列中;生产者(自己实现)用于将数据发送到Broker;消费者(自己实现)用于从消息队列中获取数据进行消费。 MQ的优势 1、应用解耦:解耦各个应用,提高系统的扩展性、容错性和可维护性;比如在电商系统中订单系统需要调用库存系统、支付系统、物流系统进行业务操作,假如库存系统宕机,那么整个系统将不可用。使用了MQ之后,订单系统与库存系统的耦合度降低,库存系统挂掉不会影响订单主业务流程。 原始架构 MQ架构 2、异步提速:提高接口响应速度和系统吞吐量,提升用户体验;在分布式架构中,我们经常使用http、rpc等方式进行服务间的接口调用,那么假如订单系统调用库存系统修改库存需要300ms,成功修改库存后再调用支付系统进行支付需要300ms,最后支付完成调用物流系统进行发货需要300ms,再加上订单入库需要50ms

Erlang basic recursion with guards

﹥>﹥吖頭↗ 提交于 2021-02-11 17:46:17
问题 I am trying to create a very simple recursive function to delete all element that have a particular value that the user decides on from a list. In haskell I would use guards and do: deleteAll_rec _ [] = [] deleteAll_rec del (x:xs) | del==x = deleteAll_rec del xs | otherwise = x:deleteAll_rec del xs I am trying to code up an Erlang equivalent, however, I am not sure how to handle the otherwise case: deleteAll_rec(_, []) -> []; deleteAll_rec(DEL, [X|XS]) when DEL =:= X -> deleteAll_rec(DEL, XS)

Is there a way to print configuration parameters?

ぐ巨炮叔叔 提交于 2021-02-10 18:33:24
问题 I have configured two parameters. inet_dist_listen_min = X inet_dist_listen_max = Y in the config file and I copied it the config file in the place it should be. Is there a way to know that either RabbitMQ or ERL receive the right parameter? Thanks. Note: Eventually I did it using a sniffer (saw the TCP port in the packet) and knew it received it, but is there a quicker way? 回答1: for rabbitmq rabbitmqctl environment for erlang env params rabbitmqctl eval 'application:get_all_env(kernel).' and

Is there a way to print configuration parameters?

冷暖自知 提交于 2021-02-10 18:28:10
问题 I have configured two parameters. inet_dist_listen_min = X inet_dist_listen_max = Y in the config file and I copied it the config file in the place it should be. Is there a way to know that either RabbitMQ or ERL receive the right parameter? Thanks. Note: Eventually I did it using a sniffer (saw the TCP port in the packet) and knew it received it, but is there a quicker way? 回答1: for rabbitmq rabbitmqctl environment for erlang env params rabbitmqctl eval 'application:get_all_env(kernel).' and

what is the difference between gen_tcp:recv and prim_inet recv

被刻印的时光 ゝ 提交于 2021-02-10 18:22:55
问题 What is prim_inet module , how it works ? i tried to google it but i didn't find any useful docs. i looked at the source file prim_inet.erl but nothing special there , dose prim_inet:async_recv spawn a new process for each recv ? 回答1: You found no useful documentation because erlang modules that are internal and not meant to be directly called from applications aren't documented. Please see "Why prim_inet undocumented. In that link you will read the following: It is undocumented because it is

what is the difference between gen_tcp:recv and prim_inet recv

a 夏天 提交于 2021-02-10 18:20:06
问题 What is prim_inet module , how it works ? i tried to google it but i didn't find any useful docs. i looked at the source file prim_inet.erl but nothing special there , dose prim_inet:async_recv spawn a new process for each recv ? 回答1: You found no useful documentation because erlang modules that are internal and not meant to be directly called from applications aren't documented. Please see "Why prim_inet undocumented. In that link you will read the following: It is undocumented because it is