pacemaker master/slave configuration for postgres-xl datanodes - heartbeat

I have created a cluster with 1 gtm (on t1), 1 coordinator (on t1) and 2 datanode (master/slave) (on t1 and t2 respectively) using postgres-xl.
I am trying to configure pacemaker heartbeat application using the below github link,
https://github.com/bitnine-oss/postgres-xl-ha
but I am getting the below status after configuration,
Cluster name: postgres-xl
Stack: corosync
Current DC: t1 (version 1.1.15-11.el7_3.4-e174ec8) - partition with quorum
Last updated: Wed Mar 14 11:41:20 2018
Last change: Wed Mar 14 11:40:25 2018 by hacluster via crmd on t1
2 nodes and 6 resources configured
Online: [ t1 t2 ]
gtm: started t1
coord: started t1
dh1-ha [master/slave]:
Started [t1]
Stopped [t2]
dh2-ha [master/slave]:
Started [t2]
Stopped [t1]
failed-action:
dn1_monitor_16000 on t2 'master', exit_reason='none'
dn2_monitor_16000 on t1 'master', exit_reason='none'
Daemon Status:
corosync: active/disabled
pacemaker: active/disabled
pcsd: active/enabled
Can anyone help ??

Related

Limit results of a joined table to the number of entries in the base table

I use Lansweeper to keep track of all server assets.
At the moment I am working on a report, which shows which webservers are installed and running.
For this I have to join to tables, Table A contains the installed webserver software, table B contains the names of the services
The expected result should like this:
VM
Version
Class
Servicename
VM1
9
Tomcat
tomcat9
VM2
9
Tomcat
tomcat9
VM2
7
Tomcat
tomcat7
VM3
9
Tomcat
tomcat9
It is working fine, except for servers where multiple webservers are installed. If I have two webservers on a machine I get 4 results in the table. This is because I join based on the VM-ID, so the result looks like this:
VM
Version
Class
Servicename
VM1
9
Tomcat
tomcat9
VM2
9
Tomcat
tomcat9
VM2
7
Tomcat
tomcat7
VM2
9
Tomcat
tomcat7
VM2
7
Tomcat
tomcat9
VM3
9
Tomcat
tomcat9
This is the SQL statement for this result:
select a.VM, a.Version, a.Class, b.Servicename
from Installedsoftware as a
inner join Services as b on a.VM = b.VM
I totally understand that this happens because of two entries in table A und table B which results in 4 entries because of the join.
Is there a way to avoid this without adding a second join condition? Because this would only help in this scenario but not if I have two tomcat9 servers on the same machine.
Is there a way to limit the results in a way like "if Table A has only two entries for VM1, then show only two lines of the joined table"?
This seems like a groupwise-maximum problem, which has several potential approaches, but all encourage a predictable, deterministic row as opposed to "I don't care which row." One way is:
select a.VM, a.Version, a.Class, b.Servicename
from dbo.Installedsoftware as a
left outer join
(
SELECT VM, Servicename, rn = ROW_NUMBER() OVER
(PARTITION BY VM ORDER BY Servicename)
FROM dbo.Services
) as b on a.VM = b.VM
AND b.rn = 1;
You could get a little closer to "I don't care" by changing:
(PARTITION BY VM ORDER BY ##SPID)
Or to a pseudo-random row (at a performance cost) using:
(PARTITION BY VM ORDER BY NEWID())

Data ingest issues hive: java.lang.OutOfMemoryError: unable to create new native thread

I'm a hive newbie and having an odyssey of problems getting a large (1TB) HDFS file into a partitioned Hive managed table. Can you please help me get around this? I feel like I have a bad config somewhere because I'm not able to complete reducer jobs.
Here is my query:
DROP TABLE IF EXISTS ts_managed;
SET hive.enforce.sorting = true;
CREATE TABLE IF NOT EXISTS ts_managed (
svcpt_id VARCHAR(20),
usage_value FLOAT,
read_time SMALLINT)
PARTITIONED BY (read_date INT)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS ORC
TBLPROPERTIES("orc.compress"="snappy","orc.create.index"="true","orc.bloom.filter.columns"="svcpt_id");
SET hive.vectorized.execution.enabled = true;
SET hive.vectorized.execution.reduce.enabled = true;
SET set hive.cbo.enable=true;
SET hive.tez.auto.reducer.parallelism=true;
SET hive.exec.reducers.max=20000;
SET yarn.nodemanager.pmem-check-enabled = true;
SET optimize.sort.dynamic.partitioning=true;
SET hive.exec.max.dynamic.partitions=10000;
INSERT OVERWRITE TABLE ts_managed
PARTITION (read_date)
SELECT svcpt_id, usage, read_time, read_date
FROM ts_raw
DISTRIBUTE BY svcpt_id
SORT BY svcpt_id;
My cluster specs are:
VM cluster
4 total nodes
4 data nodes
32 cores
140 GB RAM
Hortonworks HDP 3.0
Apache Tez as default Hive engine
I am the only user of the cluster
My yarn configs are:
yarn.nodemanager.resource.memory-mb = 32GB
yarn.scheduler.minimum-allocation-mb = 512MB
yarn.scheduler.maximum-allocation-mb = 8192MB
yarn-heapsize = 1024MB
My Hive configs are:
hive.tez.container.size = 682MB
hive.heapsize = 4096MB
hive.metastore.heapsize = 1024MB
hive.exec.reducer.bytes.per.reducer = 1GB
hive.auto.convert.join.noconditionaltask.size = 2184.5MB
hive.tex.auto.reducer.parallelism = True
hive.tez.dynamic.partition.pruning = True
My tez configs:
tez.am.resource.memory.mb = 5120MB
tez.grouping.max-size = 1073741824 Bytes
tez.grouping.min-size = 16777216 Bytes
tez.grouping.split-waves = 1.7
tez.runtime.compress = True
tez.runtime.compress.codec = org.apache.hadoop.io.compress.SnappyCodec
I've tried countless configurations including:
Partition on date
Partition on date, cluster on svcpt_id with buckets
Partition on date, bloom filter on svcpt, sort by svcpt_id
Partition on date, bloom filter on svcpt, distribute by and sort by svcpt_id
I can get my mapping vertex to run, but I have not gotten my first reducer vertex to complete. Here is my most recent example from the above query:
----------------------------------------------------------------------------------------------
VERTICES MODE STATUS TOTAL COMPLETED RUNNING PENDING FAILED KILLED
----------------------------------------------------------------------------------------------
Map 1 .......... container SUCCEEDED 1043 1043 0 0 0 0
Reducer 2 container RUNNING 9636 0 0 9636 1 0
Reducer 3 container INITED 9636 0 0 9636 0 0
----------------------------------------------------------------------------------------------
VERTICES: 01/03 [=>>-------------------------] 4% ELAPSED TIME: 6804.08 s
----------------------------------------------------------------------------------------------
The error was:
Error: Error while processing statement: FAILED: Execution Error, return code 2 from org.apache.hadoop.hive.ql.exec.tez.TezTask. Vertex failed, vertexName=Reducer 2, vertexId=vertex_1537061583429_0010_2_01, diagnostics=[Task failed, taskId=task_1537061583429_0010_2_01_000070, diagnostics=[TaskAttempt 0 failed, info=[Error: Error while running task ( failure ) : java.lang.OutOfMemoryError: unable to create new native thread
I either get this OOM error which I cannot seem to get around or I get datanodes going offline and not being able to meet my replication factor requirements.
At this point I've been troubleshooting for over 2 weeks. Any contacts for professional consultants I can pay to solve this problem would also be appreciated.
Thanks in advance!
I ended up solving this after speaking with a Hortonworks tech guy. Turns out I was over-partitioning my table. Instead of partitioining by day over about 4 years I partitioned by month and it worked great.

ShareLock and ExclusiveLock with postgres database

I was checking the lock in logs of one application which is running in heroku and its shows so many lock from delayed_jobs and increment_counter, also these time i got so many timeouts
sql_error_code = 00000 LOG: process 129728 still waiting for ShareLock on
transaction 1296511670 after 1000.149 ms
2017-06-02T16:24:58+00:00 app
postgres.129728 - - [TEST] [7-2] sql_error_code = 00000 DETAIL: Process
holding the lock: 129457. Wait queue: 129728.
02 Jun 2017 20:24:58.338198 <134>1 2017-06-02T16:24:58+00:00 app
postgres.129728 - - [TEST] [7-3] sql_error_code = 00000 CONTEXT: while
locking tuple (75,2) in relation "delayed_jobs"
LOG: process 129429 acquired ExclusiveLock on tuple (878044,83) of relation
16953 of database 16385 after 3220.356 ms
02 Jun 2017 20:24:58.338591 <134>1 2017-06-02T16:24:58+00:00 app
postgres.129728 - - [TEST] [7-4] sql_error_code = 00000 STATEMENT: UPDATE
"delayed_jobs" SET locked_at = '2017-06-02 16:24:57.033870', locked_by =
'host:a96aff72dae123123e pid:4' WHERE id IN (SELECT id FROM
"delayed_jobs" WHERE ((run_at <= '2017-06-02 16:24:57.032776' AND (locked_at
IS NULL OR locked_at < '2017-06-02 12:24:57.032817') OR locked_by =
'host:a96aff72dae123123e pid:4') AND failed_at IS NULL)
ORDER BY priority ASC, run_at ASC LIMIT 1 FOR UPDATE) RETURNING *
sql_error_code = 00000 DETAIL: Process holding the lock: 129495. Wait queue:
3276.
02 Jun 2017 20:25:09.279197 <134>1 2017-06-02T16:25:08+00:00 app
postgres.3276
- - [TEST] [7-3] sql_error_code = 00000 CONTEXT: while updating tuple
(878034,120) in relation "messages"
02 Jun 2017 20:25:09.279248 <134>1 2017-06-02T16:25:08+00:00 app
postgres.3276
- - [TEST] [7-4] sql_error_code = 00000
STATEMENT: UPDATE "messages" SET
"item_no" = COALESCE("item_no", 0) + 1 WHERE "messages"."id" =
48290879
I think this is not a normal lock, is there any way to fix these kind of lock?
I don't know what you consider a "normal" kind of lock to be. This is the normal kind of lock you get when multiple transactions try to update (or to select for update) on the same tuple at the same time.
But why are the transactions that are taking these locks holding on to them for at least a second? Are the transactions inherently slow, or are they getting distracted?

SQL Server 2012 job scheduling

I have a situation where I have 1 package (Package A) that take about 3 min to complete and another package (Package B) that takes about 4 min to complete. I need package A to run every 5 min via a job and package B to run every 15 min. However package B can only run after package A has been completed.
Example
5- Package A runs
10- Package A runs
15- Package A runs and then Package B
20- Package A runs
25- Package A runs
30- Package A runs and then Package B
Is there any way to schedule jobs to meet the requirements above?
Really appreciate your help. Thanks in advance!
for package B i would just put in logic to check if package A has stopped running
the wait script would be
WHILE EXISTS (
SELECT
*
FROM
msdb.dbo.sysjobs_view job
JOIN
msdb.dbo.sysjobactivity activity
ON
job.job_id = activity.job_id
JOIN
msdb.dbo.syssessions sess
ON
sess.session_id = activity.session_id
JOIN
(
SELECT
MAX( agent_start_date ) AS max_agent_start_date
FROM
msdb.dbo.syssessions
) sess_max
ON
sess.agent_start_date = sess_max.max_agent_start_date
WHERE
run_requested_date IS NOT NULL AND stop_execution_date IS NULL
AND job.name = 'package A')
BEGIN
WAITFOR DELAY '00:00:30';
END
This would check every 30 seconds if package A has stopped running.
Alternatively, you create a table that would keep track of job status and have A write to it to keep track of the status.

Error 3296: Join expression not supported in MS Access Query with multiple JOIN

I'm using Access 2003 and doing a make table query.
The idea is, I have multiple tables containing all kinds of info on a list of funds, and I am trying to combined them. All tables have FundID as one of the fields, and this is the field we use to identify each individual fund. There's a table for a field MER, which are updated from time to time. So we have to apply the MER values for its applicable periods. Here's my SQL code:
SELECT
[Fund Mapping].FundID,
[Fund Mapping].FundName,
[MarketValues].DateLookup,
[MarketValues].[SumOfCurrentAmt]/100 AS [MV By Fund],
[Fund Prices # Month End].Price,
IIf([MarketValues].DateLookup<"200908",[MER (08 to Jul 09)].MER,
IIf([MarketValues].DateLookup<"200911",[MER (Aug 09 to Oct 09)].MER,
IIf([MarketValues].DateLookup<"201008",[MER (Nov 09 to Jul 10)].MER,
IIf([MarketValues].DateLookup<"201106",[MER (Aug 10 to May 11)].MER,[MER (Jun 11 to present)].MER)
)
)
) AS MER
INTO [Fund Data]
FROM [Fund Mapping],
[MER (08 to Jul 09)] RIGHT JOIN
([MER (Aug 09 to Oct 09)] RIGHT JOIN
([MER (Nov 09 to Jul 10)] RIGHT JOIN
([MER (Aug 10 to May 11)] RIGHT JOIN
([MER (Jun 11 to present)] RIGHT JOIN
([MarketValues] INNER JOIN [Fund Prices # Month End]
ON ([MarketValues].DateLookup = [Fund Prices # Month End].DateLookup)
AND ([MarketValues].FundID = [Fund Prices # Month End].[Fund ID]))
ON [MER (Jun 11 to present)].FundID = [MarketValues].FundID)
ON [MER (Aug 10 to May 11)].FundID = [MarketValues].FundID)
ON [MER (Nov 09 to Jul 10)].FundID = [MarketValues].FundID)
ON [MER (Aug 09 to Oct 09)].FundID = [MarketValues].FundID)
ON [MER (08 to Jul 09)].FundID = [MarketValues].FundID
GROUP BY
[Fund Mapping].FundID,
[Fund Mapping].FundName,
[MarketValues ].DateLookup,
[SumOfCurrentAmt]/100,
[Fund Prices # Month End].Price,
IIf([MarketValues].DateLookup<"200908",[MER (08 to Jul 09)].MER,
IIf([MarketValues].DateLookup<"200911",[MER (Aug 09 to Oct 09)].MER,
IIf([MarketValues].DateLookup<"201008",[MER (Nov 09 to Jul 10)].MER,
IIf([MarketValues].DateLookup<"201106",[MER (Aug 10 to May 11)].MER,[MER (Jun 11 to present)].MER)
)
)
)
ORDER BY
[Fund Mapping].FundID,
[MarketValues].DateLookup;
DateLookup are strings with the format of YYYYMM. The reason why I am using RIGHT JOIN instead of INNER JOIN is because there can be new funds added, so the earlier MER tables will not have all the FundIDs. The "MarketValues INNER JOIN Fund Prices # Month End" table should be the base of this whole thing - it has all the funds, and nothing should be dropped from this.
When I tried to save the query, it gave me an error message saying JOIN expression not supported. I don't know what's wrong or how I can fix it.
Help please? Thanks in advance!
========== UPDATE #1
I manually added each of the join properties and the entire query from scratch in design view. It gave me pretty much the same code as above, but allowed me to save (the code above gives me an error whenever I try to save).
But when I tried to run the query, it gives me an error message that says: "The SQL statement could not be executed because it contains ambiguous outer joins. To force one of the joins to be performed first, create a separate query that performs the first join and then include that query in your SQL Statement."
Is there no other way around this?
========== UPDATE #2
So I digged a bit further, and was able to resolve the problem and have the query run properly.
Turns out all I had to do was to JOIN [Fund Mapping] table together with all the other tables! Ie, all the tables I am selecting from are joined together.
Just thought I should give an update in case anyone else encounters the same problem.
Thank you for helping out!
I think the problem is mixing 'old style' cross join with infix join style e.g. consider this simplified example that generates the same error:
SELECT *
FROM T1, T2 RIGHT JOIN T3 ON T2.c = T3.c;
One simple fix to the above is to perform the RIGHT JOIN in another scope e.g. in a derived:
SELECT *
FROM T1, (
SELECT T2.*, T3.c2
FROM T2 RIGHT JOIN T3 ON T2.c = T3.c
) AS DT1;
See Update #2 for solution to this problem.