Skip to content

Instantly share code, notes, and snippets.

@eloycoto
Last active May 30, 2017 10:15
Show Gist options
  • Save eloycoto/4a9f079a718addee754fb295a395f11c to your computer and use it in GitHub Desktop.
Save eloycoto/4a9f079a718addee754fb295a395f11c to your computer and use it in GitHub Desktop.
totem {
version: 2
cluster_name: lbcluster
transport: udpu
secauth: off
}
quorum {
provider: corosync_votequorum
two_node: 1
}
nodelist {
node {
ring0_addr: 192.168.89.38
}
node {
ring0_addr: 192.168.89.33
}
}
logging {
to_logfile: yes
logfile: /var/log/corosync/corosync.log
timestamp: on
}
#include <stdio.h>
#include <corosync/cpg.h>
#include <corosync/cfg.h>
static corosync_cfg_handle_t cfg_handle;
static void cfg_shutdown_cb(corosync_cfg_handle_t cfg_handle,
corosync_cfg_shutdown_flags_t flags)
{
}
int main (void){
/* corosync_cfg_handle_t cfg_h; */
cs_error_t cs_err;
unsigned int node_id;
int numaddrs;
int result;
corosync_cfg_node_address_t addrs;
corosync_cfg_handle_t handle;
printf("Hello, world! %ld \n", handle);
result = corosync_cfg_initialize (&handle, NULL);
if (result != CS_OK) {
printf ("Could not initialize corosync configuration API error %d\n", result);
}
cs_err = corosync_cfg_local_get(handle, &node_id);
printf("Hello, world! %i %i\n", node_id, cs_err);
cs_err = corosync_cfg_get_node_addrs(handle, node_id, 1, &numaddrs, &addrs);
printf ("Hello, world! %i\n", cs_err);
return 0;
}
gcc data.c -std=c99 -o merda -lcpg -l cfg -o merda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment