"Herring magistrates" were Japanese samurai who patrolled the beaches of Hokkaido in the Edo period to prevent people from frightening or abusing herring.
During Japan's Edo period (1600-1868), the northern island of Hokkaido was a wild frontier populated by the native Ainu people. For the most part, Japanese people were forbidden to travel to Hokkaido or trade with the Ainu by the Tokugawa shogunate, with the exception of the southwest tip of the island which was a Japanese colony administered by Matsumae family of feudal lords.
Most of Edo-era Japan's economy and monetary system was based on rice, measured in koku (supposedly, the amount of rice one man would eat in a year). Rice would not grow in Hokkaido's frigid climate, however, so Matsumae domain had to look to other sources for income. Trade with the Ainu was reasonably profitable, but the true foundation of the Matsumae economy was the Hokkaido herring fishery, which could be spectacularly productive in a good year, with herring runs so vast that fishers could literally wade into the ocean and scoop herring out of the sea with their hands or buckets, their catch limited only by how fast they could scoop. The herring would then be processed into fertilizer, which would be shipped to the cotton fields of central Japan, where it helped fuel an agricultural revolution.
Herring are remarkable skittish, however, and could easily be scared away from shore. To prevent this from happening and causing immense damage to the domain's economy, the domain passed an elaborate series of laws, the nishinryô okite, or "Herring Fishing Ordinances", proscribing behaviors liable to negatively affect the size and proximity to shore of the herring runs. One law issued in 1691, for example, demanded that no one should discharge a firearm within earshot of the sea between February and May (when the herring ran). Other laws banned bonfire parties on the beaches or fishing at night when the herring spawned.
These were not empty proclamations - the Matsumae domain was dead serious about enforcing them. To this end, it appointed a force of low-ranking samurai as nishin banshobugyô, literally "herring magistrates", who patrolled the beaches of the domain in the spring months arresting and punishing violators of the herring laws.