Internet of Vehicles (IoV) plays a fundamental role in the rapid development of intelligent transportation systems and smart cities by the way of facilitating data access. However, traditional routing protocols-based data forwarding cannot guarantee reliable services for low-latency applications in IoV. Motivated by the promising technologies of Software-defined networking (SDN) and Mobile-edge computing, this paper aims at enhancing the performance of IoV with the assistance of these two. Specifically, we first propose a three-layer hierarchy control framework for SDN-IoV based on the MEC. Under this framework, we investigate a controller placement problem with the objective of minimizing the delay between the switch and the controller. Then, we propose a Louvain algorithm-based controller placement policy to obtain the optimal location of controllers subject to load balance index and buffer size. Further, we put forward a controller replacement policy to adapt to the dynamic topology of IoV. Numerical results show that the proposed methods achieve a better performance than two baselines, in terms of the delay and load balance index.