China is a big consumer of melons and fruits and vegetables,with a vast land area,but there is less arable land,and most of the cultivated land is used to grow food.The planting area of melons and fruits and vegetables is insufficient,and the traditional cultivation methods cannot meet people ’s the huge demand for fruits and vegetables,the emergence of greenhouses provides a suitable growth environment for fruits and vegetables,overcomes the plants’ seasonal climate requirements,and can grow many seasons fruits and vegetables in a year.This paper combines microservices and IoT technology,researches and designs a greenhouse planting measurement and control system based on SpringCloud microservice architecture,builds a highly cohesive and low-coupling distributed background application system architecture,and realizes intelligent management of greenhouse.The manager of the greenhouse can manage multiple greenhouses through the WeChat public account client,and can remotely adjust and monitor the environment of the greenhouse.The system administrator performs unified management of the system through a browser.The main content of the paper is as follows:(1)In response to the infrastructure requirements of the greenhouse planting measurement and control system,an information collection platform for the greenhouse planting measurement and control system was designed.The RS485 communication protocol was used to collect the air temperature,air humidity,light intensity,CO2 solubility,soil humidity and water level of the storage tank in the greenhouse.For other parameters,the WIFI wireless communication technology is used to connect to the Internet,and the TCP protocol is used to communicate with the application program of the remote server.(2)Use the MySQL database to save data,and use the Multi-Master Replication Manager for MySQL to monitor the MySQL master-master replication,to achieve failover of the master database.(3)As the functions of the greenhouse measurement and control system change,the monolithic back-end applications become increasingly complex and huge.To reduce the coupling of the back-end application systems,SpringCloud is applied to the greenhouse measurement and control field for the first time.SpringCloud is used to split the service of the system back-end applications according to the service The principle of splitting splits background applications into database management applications,instant messaging applications,WeChat public account applications,and asynchronous messaging applications.(4)To ensure the security of data transmission,the SHA1 algorithm is used to encrypt the network information data of instant messaging applications,and random numbers are introduced to improve the SHA1 algorithm.(5)For the access needs of users in greenhouses,use WeChat public account as the client.The WeChat public account client provides a good human-computer interaction interface,real-time data query,historical data query,remote control and other functions.Provides a web site for system administrators and provides functions such as user and device account management.Finally,tests have shown that the hardware part of this system installed in a greenhouse can run stably for a long time.The various microservices(basic applications such as service registration center and related business applications)running on the container management platform Rancher are running normally,and the overall startup time does not exceed 120 seconds.The functions of service fuse,remote call and database failover are normal,and the software system has the characteristics of high availability,scalability and robustness.The greenhouse planting measurement and control system implements functions such as remote control equipment,historical data query,asynchronous message notification,and instant messaging.User concurrency is around 50 per second,and the average request time is between 60 ms and 70 ms,which can meet the needs of the greenhouse planting measurement and control system. |