redis,erlang,chicagoboss , Chicago_boss and redis config


Chicago_boss and redis config

Question:

Tag: redis,erlang,chicagoboss

I am looking to configure a chicago boss application for redis. I am using the eredis gem (https://github.com/wooga/eredis). Is there a way to do this from within my boss.config?


Answer:

If you want to use eredis for caching in CB, I have bad news for you. According to documentation:

At present only Memcached cache servers are supported,
but additional adapters will be added in the future.

However, if you want to use eredis for something else in your application, then according to eredis docs you need to provide the details at startup:

To start the client, use any of the eredis:start_link/0,1,2,3,4,5 functions. They all include sensible defaults. start_link/5 takes the following arguments:

Host, dns name or ip adress as string
Port, integer, default is 6379
Database, integer or 0 for default database
Password, string or empty string([]) for no password
Reconnect sleep, integer of milliseconds to sleep between reconnect attempts

If you don't want to hard-code those values in the code, that starts the application, you can provide them in boss.config:

{ your_app_name, [
    {eredis_host, "some.host.name"},
    {eredis_port, 1234},
    ...
]}

Then, in your code, you can use EredisHost = application:get_env(your_app_name, eredis_host) to obtain the host name and use it during start.


Related:


I'm trying to import an external Redis database (.RDB file) on a Redis installation on Windows but the new data is not being loaded?


database,import,redis,nosql
I have been trying for hours to import a .RDB Redis database file into a new installation on my local machine. I have followed all the steps on Stackoverflow stating to basically drop the dump.rdb into the installation folder (i.e. what it's condifured to read in the .conf file. See...

How to understand text language in utf8 encoded text?


node.js,utf-8,character-encoding,redis,language-detection
Redis is using utf8 code and for my project I need to get text language which is utf8 encoded text. Is there any way that can give a clue about the language of the text? EDIT: My project is on NodeJs programming language. In Redis maybe lua script has a...

passing arrays to a function in erlang


arrays,function,erlang,arguments
I am new to erlang programming and as a matter of fact no very experienced programmer. I need to pass an array to a function and then manipulate it.. however I have so far not be this what I found. module(easy). export([myfunction/1]). myfunction([myarray]) -> %% mycode.. hier I will need...

Erlang: Returning a function from a function


erlang
I know Erlang supports anonymous functions. My question is, can I return a function from a function then call that returned function from outside? If so, how do I do it? I know this is possible in many languages such as C and Python. Here is what I tried to...

Erlang syntax error unclear


function,variables,if-statement,functional-programming,erlang
I just got started with Erlang. I am trying if statement. I found out one particular behavior which I do not understand. the following statement does work perfectly. some_comp(Arg1) -> if (cal(Arg1)>50000)->'reached'; true -> 'invalid' end. cal(Arg2)-> %% some calculation. However the following shows an error syntax near if: some_comp(Arg1)...

Redis Cache .Net Client


.net,redis,server
Does anyone know if Amazon supports C# client libraries for making calls to Redis Server? I know service stack and stack exchange are the only two libraries right now, but Amazon makes no mention of them at all.

erlang processes and message passing architecture


concurrency,process,erlang,messages
The task I have in hand is to read the lines of large file, process them, and return ordered results. My algorithm is: start with master process that will evaluate the workload (written in the first line of the file) spawn worker processes: each worker will read part of the...

erlang message passing architecture


process,erlang,messaging
In erlang if two processes A and B are sending message to a process C simultaneously. Will there be a race condition? C ! {very large message} sent by A C ! {very large message} sent by B Will C receive the complete message from A and then proceed for...

What is the use of privdata argument in redisAsyncCommand?


c,redis,hiredis
The function definition provided in the source for redisAsyncCommand( ) is: static int __redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, const char *cmd, size_t len) { ... } What is the purpose of the void *privdata argument? In what cases would it be useful?...

What is the difference between .app and .app.src files in Erlang?


erlang
I found these description in the Erlang doc and learnyousomeerlang.com, but not sure which one is the "Application Resource File". When should I use .app and .app.src? 7.3 Application Resource File http://www.erlang.org/doc/design_principles/applications.html The Application Resource File http://learnyousomeerlang.com/building-otp-applications...

How change redis to be persistent


redis
I use redis. I want that the DB will be persistent, but when I kill my process, I notice that the data doesn't recover. In example, I have 100 keys and values. my process run on id = 26060. When I do: kill -9 26060 and run redis-server again, all...

Type errors in dialyzer in function with specified type


erlang,dialyzer
I am receiving an error in dialyzer when it analyzes the following function. -spec do_request(Method, Type, Url, Expect, Headers, Body, Client) -> Response::client_response() when Method :: method(), Type :: content_type(), Url :: url(), Expect :: status_codes(), Headers :: headers(), Body :: body(), Client :: #client{}. do_request(Method, Type, Url, Expect, Headers,...

Does the pattern [_|_] in Erlang mean anything specific?


erlang
I am learning Erlang from Learn You Some Erlang and I've seen the pattern [_|_] twice already but couldn't find any info on it. This usage seems superfluous because omitting it from (1) and subsituting it with _ in (2) yields the same result without degrading readability. It is my...

node.js redis and how to use promise when using a module


javascript,node.js,redis,promise,q
I have an Express route like this in an node server (file is required): var redis = require('../modules/redis'); module.exports = function (app) { var redisClient = redis.init(); app.post('/auth/ticket', cors(), function (req, res) { var hashes = ['hash1','hash2', 'hash3']; var candidates = []; // An array to collect valid hashes var...

Elixir exrm release crashes on eredis start_link


erlang,elixir,exrm
I'm fairly new to Elixir and this is the first app that I'm attempting to release using exrm. My app interacts with a Redis database for consuming jobs from a queue (using exq), and also stores results of processed jobs in Redis using eredis. My app works perfectly when I...

Predis: Pros and Cons of the two cluster strategies


php,session,redis,cluster-computing,predis
I am using Predis to connect to a Redis 3.0.2 cluster. So, I have an option to use either predis or redis cluster strategy. I am wondering if there are any significant pros and cons of choosing one of them over the other? Based on my wandering through documentation, I...

hmset redis with result from mysqlDB


php,arrays,redis
Im very new to Redis, and after have seeing the redis FAQ i have a question regarding hmset. It seems like hmset is the best way for me to store user rows from my mysql DB. So if i had an array returned from mysql like this: array( 'userid' =>...

How to list all the bucket types in riak?


erlang,riak
Using Riak Client(erlang), I can list all the buckets of the default bucket type. But how can I list all the bucket types? Or If I can't do this by the client, how can I find out about this?

How to invoke Erlang function with variable?


erlang
4> abs(1). 1 5> X = abs. abs 6> X(1). ** exception error: bad function abs 7> erlang:X(1). 1 8> Is there any particular reason why I have to use the module name when I invoke a function with a variable? This isn't going to work for me because, well,...

Can RPUSH and LPUSH in Redis race?


transactions,redis,race-condition
The docs at redis.io on RPUSH and LPUSH aren't clear on whether or not these operations are still O(1) and transational when pushing multiple items. For example, if two clients perform an RPUSH to the same list with multiple items, can their items become interspersed and thus out of order?...

Getting a sibling process in Elixir


erlang,elixir,otp
I have an Elixir/Erlang process tree: parent (Supervisor) ├── child1 (GenServer) └── child2 (GenServer) child1 (a DB client) has information that child2 needs to use. What's a good way to pass a reference from the Supervisor process to child2 so that child2 will always have a valid reference to child1?...

how to handle low_entropy exception of crypto:strong_rand_bytes(N)?


openssl,erlang
I want to generate cryptographically strong pseudorandom numbers in erlang for session IDs. There is crypto:strong_rand_bytes(N). What if it throws the low_entropy exception? From http://www.erlang.org/doc/man/crypto.html#strong_rand_bytes-1 strong_rand_bytes(N) -> binary() Types: N = integer() Generates N bytes randomly uniform 0..255, and returns the result in a binary. Uses a cryptographically secure prng...

Is exists check required before calling StringSet method of StrackExchange.Redis


c#,redis,stackexchange.redis
I am using the StackExchange.Redis 1.0.450 nuget in C#. I have code like below which checks if a keyexists in redis before adding it - if (!Cache.KeyExists(fKey)) { Cache.StringSet(fKey, Serialize(data)); } where Cache is Database object I was reading about the redis SET command here http://redis.io/commands/set and found that SET...

using Go redis client (Redigo)


go,redis
I'm using GO redis client redigo to write image to ~20 redis servers. speed is an important factor here and I'm just sending set commands to the redis so I'm using Send and Flush without calling Receive. after a few hours I'm getting "connection reset by peer" on the client....

Loop until i get correct user


ruby,redis
I have users stored in Redis and want to be able to call only certain subsets from a set, if i don't get the correct user back i want to put it back in the set and then try again until i get one of the desired users @redis =...

Redis - linux / Error when Installing redis on linux: `cc: command not found`


linux,redis
I wish to install redis on my red-hat environment. I do the following: wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.tar.gz cd redis-stable make I got the next error: make[3]: *** [net.o] Error 127 make[3]: Leaving directory `/tmp/redis-stable/deps/hiredis' make[2]: *** [hiredis] Error 2 make[2]: Leaving directory `/tmp/redis-stable/deps' make[1]: [persist-settings] Error 2 (ignored) CC...

ctrl+G in erl doesn't work


unicode,encoding,utf-8,erlang,docker
I'm trying to interconnect erlang nodes, but entering ctrl+G doesn not work: Eshell V6.4.1 (abort with ^G) 1> ^G Eshell V6.4.1 (abort with ^G) 1> ^G Eshell V6.4.1 (abort with ^G) 1> ^G Eshell V6.4.1 (abort with ^G) any idea why this can happen? I was thinking about locale settings,...

Erlang pass-by-reference nuances


erlang,pass-by-reference
9> A = lists:seq(1,10). [1,2,3,4,5,6,7,8,9,10] 13> Fn = fun (L) -> [0|L] end. #Fun<erl_eval.6.90072148> 14> Fn(A). [0,1,2,3,4,5,6,7,8,9,10] 15> A. [1,2,3,4,5,6,7,8,9,10] If erlang internally passes by reference (see this), why does the value of A not reflect the change? What fundamental am I missing about passing-by-reference or erlang?...

node js redis pubsub


mysql,node.js,redis,publish-subscribe
I'm really beginner of nodejs. I want to make a chatting service using nodejs. I use nodejs/jade/mysql to construct basic part of my system and now i want to provide pub/sub to users. we receive users' interests from text field or using hash tags..(anyway we received users' interests and stored...

Set options for ZADD command in laravel redis


php,laravel,redis,set
I'm trying to set options for ZADD with laravel redis but am failing. The option I need to set is NX, as stated in the documentation: ZADD options (Redis 3.0.2 or greater) ZADD supports a list of options, specified after the name of the key and before the first score...

How To Restore a Missing Redis Service


linux,redis,centos
I installed an older version of Redis on a CentOS server. I tried to remove that old version and update it to latest version, but it seems that the redis service is gone and the new version installation doesn't reproduce it. Is there any way I can uninstall the Redis...

Using Redis as a session state provider


asp.net,session,redis,stateless
I am wanting to create real RESTful APIs with ASP.Net. According to REST architecture. The application must be stateless. Meaning I can't use normal sessions. I found a document here describing how to use Redis as a session state provider. Since it would be external (as in not part of...

Erlang spawning large amounts of C processes


c,multithreading,lua,erlang,ffi
I've been looking into how I could embed languages (let's use Lua as an example) in Erlang. This of course isn't a new idea and there are many libraries out there that can do this. However I was wondering if it was possible to start a Genserver with state which...

Using redis as a DB for some values


node.js,redis
I notice that all the examples of redis contains key-value option. For example: key1 value1 key2 value2 key3 value3 But my DB is more complex, and I wish to support some values of keys. key1 createday1 deleteday1 size1 key2 createday2 deleteday2 size2 key3 createday3 deleteday3 size3 Also, I wish to...

Getting SSL related error against my request to Ejabberd


android,sockets,ssl,erlang,ejabberd
Following is the code snippet where i open a socket to write APNS notifications on: get_socket()-> %%Options Options = [{certfile, ?Cert}, {keyfile, ?Key}, {mode, binary}], %%ssl connection ssl:connect(?Address, ?Port, Options, infinity) . close_socket(Socket)-> ssl:close(Socket). I am getting the following crash in my ejabberd.log file 2015-06-05 12:33:17.112 [error] <0.3134.0> gen_fsm <0.3134.0>...

Fast mutable objects in Erlang


erlang
What is the best approach to store and manage high-performance mutable objects in Erlang? Assume that I want to write really simple online game server with realtime gameplay. Somehow I need to represent player's state in Erlang memory. For example, it could be just a simple tuple like {name, "Bob",...

Redis: Delete user token by email ( find Key by Value )


node.js,express,redis
I have followed tutorial on how to create token-based authentication with node from this tutorial http://www.kdelemme.com/2014/08/16/token-based-authentication-with-nodejs-redis/ I got it all worked out, but I got 1 problem. The way I store token is : KEY = TOKEN VALUE = UserData (Username, email, etc.) To protect multiple devices login, I would...

Redis - Delete/pop if more than x members in set


performance,redis
In Redis, I have millions of sets with varying quantities of members. I want to reduce the overall size and really only need the latest members added to a set. Is there an operation to pop/delete any members for each key until the total length is 10 or less?...

Docker - Cannot start Redis Service


redis,docker
I'm installation Redis, setting up init.d, placed the redis.conf beside init.d. Then using CMD service init.d start to start Redis. However, Redis-Server does not start, and there are no indiciation in the log file that the service failed to start. Installing Redis and Placing redis.conf to the etc/init.d folder Commands:...

First word of binary string erlang


functional-programming,erlang,pattern-matching
I need to do something like this <<"Some text in binary">>, and it should return <<"Some">. How can i do it without split function, only by pattern matching and select/if cases with Erlang. Thank you.

Redis Serialization and Deserialization


redis,deserialization,spring-data,serializable,spring-data-redis
I have noticed that some of my serialized objects stored in Redis have problems deserializing. This typically occurs when I make changes to the object class being stored in Redis. I want to understand the problem so that I can have a clear design for a solution. My question is,...

erlang os:cmd() command with UTF8 binary


unicode,encoding,erlang,utf
I'm trying to get an Erlang function to execute a bash command containing unicode characters. For example, I want to execute the equivalent of: touch /home/jani/ჟანიweł I put that command in variable D, for example: io:fwrite("~ts", [list_to_binary(D)]). touch /home/jani/ჟანიwełok but after I execute: os:cmd(D) I get file called á??á??á??á??weÅ?. How...

Why doesn't spawn link cause the calling process to die?


erlang,erlang-shell
From the example given here, Erlang and process_flag(trap_exit, true) -module(play). -compile(export_all). start() -> process_flag(trap_exit, true), spawn_link(?MODULE, inverse, [***0***]), loop(). loop() -> receive Msg -> io:format("~p~n", [Msg]) end, loop(). inverse(N) -> 1/N. If I run it as, A = spawn(play, start, []). The spawned process <0.40.0> dies as it is suppose...

Getting a lost Sentinel error message for Redis


redis,spring-boot,spring-data-redis
I am running a spring boot service using spring data redis and here is the following configuration. The service seems to work but I am seeing a stream of Lost Sentinel messages in the logs. The sentinel nodes are reachable form the VM where I am running the service. I...

nodejs Kue job processing logic


node.js,redis,kue
I have a very simple logical question. I will be running job processing logic on a separate app server. My job processing app will be a standalone app, doing nothing just processing jobs. In my code, how do I make sure that my app continuously keep checking redis server for...

Socket.io redis How data stored and cleared


redis,socket.io,socket.io-redis
i am hosting an app on heroku which is using socket.io. it is using sockets and i am using heroku 4 standard 1X dynos . So for this i used redistogo service and socket.io-redis plugin. it's working great but i want to know does socket.io-redis also clear the data from...

Mnesia pagination with fragmented table


pagination,erlang,mnesia
I have a mnesia table configured as follow: -record(space, {id, t, s, a, l}). mnesia:create_table(space, [ {disc_only_copies, nodes()}, {frag_properties, [ {n_fragments, 400}, {n_disc_copies, 1}]}, {attributes, record_info(fields, space)}]), I have at least 4 million records for test purposes on this table. I have implemented something like this Pagination search in Erlang...

Erlang driver erl_errno issue


erlang,erlang-driver
I am playing with erl_driver. Start callback of my driver is below: ErlDrvData drv_start(ErlDrvPort port, char* command) { char* file_name = command + sizeof(drv_name); GenTtyData* port_data = (GenTtyData*)driver_alloc(sizeof(GenTtyData)); erl_errno = gt_open(file_name, &port_data->file); if (erl_errno != 0) { // Assertion there is just to show you my intention assert(erl_errno == ENOENT);...

predis: ZADD with NX keeps throwing error 'Predis\ServerException'


redis,predis
I am having an issue when I try to add "NX" to the zadd command on predis. The redis docs say that ZADD should support NX, but no matter how I set up the predis command, I can not get it working. Does anyone have any experience with this issue?...

Does Erlang has Map?


erlang
It seems that Erlang introduced maps in version R17A. But, if I go to downloads I only see version 17.5, there's no version R17A. So, is it released and stable yet? Does the latest stable Erlang has Map support?...