@Override
    public boolean selectMaster(final String masterHost, final String masterPort, final String contextPath) {
        masterFlag = clusterMasterLock.tryLock();
        if (masterFlag) {
            Timestamp now = Timestamp.valueOf(LocalDateTime.now());
            ClusterMasterDO masterDO = ClusterMasterDO.builder()
                    .id(MASTER_ID)
                    .masterHost(masterHost)
                    .masterPort(masterPort)
                    .contextPath(contextPath)
                    .dateCreated(now)
                    .dateUpdated(now)
                    .build();
            try {
                clusterMasterMapper.insert(masterDO);
            } catch (Exception e) {
                clusterMasterMapper.updateSelective(masterDO);
            }
        }
        return masterFlag;
    }
The cluster select master service jdbc impl.
shenyu-admin/src/main/java/org/apache/shenyu/admin/mode/cluster/impl/jdbc/ClusterSelectMasterServiceJdbcImpl.java