title: Multiple airflow schedulers
body: <p>I am trying to install three node airflow cluster. Each node has airflow scheduler, airflow worker, airflow webserver, also it has celery, RabbitMQ cluster and Postgres multi master cluster(implemented with Bucardo). Versions of software:</p>
  <ul>
  <li>Airflow 2.0.1</li>
  <li>Postregsql 13.2</li>
  <li>Ubuntu 20.04</li>
  <li>pyhton 3.8.5</li>
  <li>celery 4.4.7</li>
  <li>bucardo 5.6.0</li>
  <li>RabbitMQ 3.8.2</li>
  </ul>
  <p>And I occur the problem starting airflow scheduler.</p>
  <p>When I launch the first one(database is empty), it successfully starts.
  But then when I'm launching another scheduler on another machine(I tried to launch on the same machine too), it fails with the following:</p>
  <pre><code>sqlalchemy.exc.IntegrityError: (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint &quot;job_pkey&quot;
  DETAIL:  Key (id)=(25) already exists.
  
  [SQL: INSERT INTO job (dag_id, state, job_type, start_date, end_date, latest_heartbeat, executor_class, hostname, unixname) VALUES (%(dag_id)s, %(state)s, %(job_type)s, %(start_date)s, %(end_date)s, %(latest_heartbeat)s, %(executor_class)s, %(hostname)s, %(unixname)s) RETURNING job.id]
  [parameters: {'dag_id': None, 'state': 'running', 'job_type': 'SchedulerJob', 'start_date': datetime.datetime(2021, 4, 21, 7, 39, 20, 429478, tzinfo=Timezone('UTC')), 'end_date': None, 'latest_heartbeat': datetime.datetime(2021, 4, 21, 7, 39, 20, 429504, tzinfo=Timezone('UTC')), 'executor_class': 'CeleryExecutor', 'hostname': 'hostname', 'unixname': 'root'}]
  (Background on this error at: http://sqlalche.me/e/13/gkpj)
  
  </code></pre>
  <p>After trying to launch a few times eventually scheduler is working. I am assuming id is incremented and then data is successfully added into database:</p>
  <pre><code>airflow=&gt; select * from job order by state;
   id | dag_id |  state  |   job_type   |          start_date           |           end_date            |       latest_heartbeat        | executor_class |           hostname           | unixname 
  ----+--------+---------+--------------+-------------------------------+-------------------------------+-------------------------------+----------------+------------------------------+----------
   26 |        | running | SchedulerJob | 2021-04-21 07:39:22.243721+00 |                               | 2021-04-21 07:39:22.243734+00 | CeleryExecutor |                machine name  | root
   25 |        | running | SchedulerJob | 2021-04-21 07:39:14.515009+00 |                               | 2021-04-21 07:39:19.632811+00 | CeleryExecutor |                machine name  | root 
  
  </code></pre>
  <p>There is a warning with log tables as well(If the second and subsequent schedulers successfully started):</p>
  <pre><code>WARNING - Failed to log action with (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint &quot;log_pkey&quot;
  DETAIL:  Key (id)=(40) already exists.
  </code></pre>
  <p>I understand why scheduler cannot insert data into table, but how should it work correctly, how to launch multiple schedulers? Official documentation tells no additional configuration required. Hope I explained very clear. Thanks!</p>