Is there a way in QGIS to dissolve a vector by two or more fields?
This is a new feature in QGIS 2.18. You can check the changelog here.
The dissolve algorithm now allows you to dissolve based on more than one field value. In previous QGIS versions a dissolve could only group features by a single field value.
Something like this should work with ogr2ogr:
ogr2ogr -f "ESRI Shapefile" -dialect sqlite -sql "select st_union(geometry) as geometry,attribute_1 a,attribute_2 b from my_data group by a,b order by a,b" my_data.shp