A method for database service to prevent dual master node using HAis provided, The method includes such steps as setting up local listening port in database service of host and standby in HA cluster system, monitoring local listening port before database instance is started, receiving connection of other database instance to local listening port, setting up local listening port in HA cluster system, setting up local listening port in HA cluster system, setting up local listening port in HA cluster system, setting up local listening port in HA cluster system, setting up local listening port inHA cluster system, setting up local listening port in HA cluster system, setting local listening port in HA cluster system, setting local listening port in HA cluster system, setting local listening port in HA cluster system. S2, in the dual-computer HA cluster system, the connection IP address of the opposite end server is respectively set in the database service of the host computer and the standby computer; S3, in the dual-machine HA cluster system, when the HA cluster resource manager starts the resources of the database service, the database service first listens to the monitoring port set locally for preventing the dual-master, and then connecting the monitoring port of the database service of the peer through the set peer server IP; S4, executing the startup process of the local database instance and other startup processes in the HA cluster system until the dual-machine HA cluster system is successfully started.