Optomechanical crystals can simultaneously modulate elastic waves and electromagnetic waves as well as localizing phonons and photons to enhance the acousto-optic interaction. In this work, a new type of optomechanical crystal nanobeam cavity is designed by periodically arranging the unit cells with double holes on both sides of a hexagonal prism. Considering the moving boundary effect and the photoelastic effect as well as using the first-order electromagnetic perturbation theory and the optomechanical coupling coefficient calculation method, the optomechanical coupling rate of the structure is calculated. The result shows that the overlap between the optical mode and the mechanical mode can be improved by changing the number of defects and optimizing the geometric structure. For the nanobeam cavity structures with different numbers of the like defects, the number of defects will only affect the action mode of the moving boundary effect and photoelastic effect in the optomechanical coupling rate, but will not change the coupling rate too much. In particular, the optomechanical coupling rate of the single defect optomechanical crystal nanobeam cavity can reach –1.29 MHz, and the equivalent mass is 42.6 fg. Moreover, the designed structure is simple and easy to process and fabricate. The coupling rate of even-symmetric optomechanical crystal nanobeam cavity based on gradient defect can reach 2.25 MHz, and the coupling rate of odd symmetric structure can reach 2.18 MHz, in which the moving boundary effect is dominant. Based on the symmetry analysis of the vibration modes of the optomechanical crystal nanobeam cavity with gradient defects, it is worth noting that only the even symmetrical vibration modes of <i>x</i>-<i>y</i>, <i>x</i>-<i>z</i> and <i>y</i>-<i>z</i> can strongly couple with the optical modes. The surface density of the moving boundary effect is calculated and analyzed, and it is found that the surface density of the acoustic resonance mode with high symmetry also possesses high symmetry. However, when the surface density of the moving boundary effect in the defect state appears adjacent to each other and cancels out each other, it will destroy the coupling mode of the moving boundary effect and reduce the coupling rate, whether the symmetry is high or low. In addition, the designed optomechanical crystal nanobeam can also improve the quality factor of the resonant cavity by optimizing the defect structure while maintaining a high optomechanical coupling rate. Therefore, this research provides an effective means to find a structure with high optomechanical coupling rate, and also presents the ideas for designing the space sensors.