Unable to get Ksafety configured
Good day, I would like to set the k safety of my vertica cluster (3 nodes) to 1. I installed operations bridge analyics with a single node and then added 2. After doing that I rebalanced using admintools. It's been running like that for a while but I saw a notification stating that " The database is currently 0-safe, which could result in catastrophic data loss " I did some rnd and followed steps on creating buddy projections(listed down below), then refreshed (SELECT START_REFRESH();)
and attempted to set the ksafety to 1: (SELECT MARK_DESIGN_KSAFE(1);)
But receieved an error stating: Current design does not meet the requirements for K = 1.
Current design is valid for K = 0. and then lists the tables ....
Any ideas on how I can get this fixed?
Create buddy projections:
select ' create projection ' || projection_schema||'.'|| anchor_table_name || '_b1 as select * from '|| projection_schema||'.'|| anchor_table_name||
' segmented by ' || segment_expression||' all nodes offset 1;'
from projections where projection_name like '%_super'
and projection_schema||'.'|| anchor_table_name || '_b1' not in (select distinct projection_schema||'.'||projection_name from projections where projection_name not like '%_super')
Comments
Have you tried running a rebalance from the command line?
admintools -t rebalance_data -d -k 1
That worked or me when I saw this issue a while back.
Hi Deanmdt,
Before marking your database as ksafe=1, you need to have buddy projections for segmented and replicated projections.
if you are using DBD, then DBD can aslo create those buddy projections for you else best method would be run below commands:
vsql=> select rebalance_cluster();
vsql=> SELECT MARK_DESIGN_KSAFE(1);
Regards,
RaghavA
Hi Jim_Knicely ,
Thanks for the info gave it a try, received the following error:
[dbadmin@03RNB-PDHPVDB02 /]$ admintools -t rebalance_data -d opsadb -k 1 -p XXXXX
Database Designer started.
DETAIL: idx != string::npos
HINT: Please report this error to Vertica
Designer finished
What version of Vertica are you using?
SELECT VERSION();
Is there a more detail error message in the vertica.log?
Since that is an internal error, you should open a ticket with support.
In the mean time...
Are you sure that all 3 nodes are up?
SELECT NODE_NAME, NODE_STATE FROM NODES;
Note that the START_REFRESH() function runs in the background. Was it still running and not completed when you issued the SELECT MARK_DESIGN_KSAFE(1) command? You will need to wait until the REFRESH complete prior to changing the K-Safety.
SELECT COUNT(*) FROM PROJECTION_REFRESHES WHERE IS_EXECUTING;
Also, check if there is a current database re-balance in process...
SELECT IS_REBALANCE_RUNNING FROM ELASTIC_CLUSTER;
If there is, you can check the status:
SELECT * FROM REBALANCE_TABLE_STATUS WHERE SEPARATED_PERCENT<>TRANSFERRED_PERCENT;
You can cancel it if you want using...
SELECT CANCEL_REBALANCE_CLUSTER();
Did you try RaghavA's suggestion? Note that the REBALANCE_CLUSTER() function runs in the background. You'll have to monitor the progress via the SQL above querying the ELASTIC_CLUSTER and REBALANCE_TABLE_STATUS tables.
Thanks!
If this is a new cluster, you can also try to create a new comprehensive design in Database Designer using a K-Safety of 1.
We can also use dbd_add_node_rebalalnce_data() function as well. It will simply create all projections as per supplied safety in argument of above function.